add checksum for menu sync
This commit is contained in:
@@ -17,5 +17,4 @@ if (menu.menu_categories)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -5,14 +5,14 @@ param_count = item.item_attributes.count
|
||||
item.item_attributes.each do|attr_id|
|
||||
menu_attr = MenuItemAttribute.find(attr_id)
|
||||
if attr_format.count == 0
|
||||
attr_format.push({ type: menu_attr.attribute_type, value: [] })
|
||||
attr_format.push({ type: menu_attr.attribute_type, values: [] })
|
||||
end
|
||||
|
||||
attr_format.each do |af|
|
||||
if menu_attr.attribute_type == af[:type]
|
||||
af[:value].push(menu_attr.value)
|
||||
af[:values].push(menu_attr.name)
|
||||
else
|
||||
new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
|
||||
new_attr = {type: menu_attr.attribute_type, values: [ menu_attr.name ] }
|
||||
attr_format.push(new_attr)
|
||||
end
|
||||
|
||||
@@ -29,14 +29,14 @@ param_count = item.item_options.count
|
||||
item.item_options.each do|opt|
|
||||
menu_opt = MenuItemOption.find(opt)
|
||||
if opt_format.count == 0
|
||||
opt_format.push({ type: menu_opt.option_type, value: [] })
|
||||
opt_format.push({ type: menu_opt.option_type, values: [] })
|
||||
end
|
||||
|
||||
opt_format.each do |af|
|
||||
if menu_opt.option_type == af[:type]
|
||||
af[:value].push(menu_opt.value)
|
||||
af[:values].push(menu_opt.name)
|
||||
else
|
||||
new_attr = {type: menu_opt.option_type, value: [ menu_opt.value ] }
|
||||
new_attr = {type: menu_opt.option_type, values: [ menu_opt.name ] }
|
||||
opt_format.push(new_attr)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
json.array! @menus do |menu|
|
||||
menu_json = json.array! @menus do |menu|
|
||||
json.id menu.id
|
||||
json.name menu.name
|
||||
json.valid_days menu.valid_days
|
||||
@@ -12,3 +12,4 @@ json.array! @menus do |menu|
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user