Showing
2 changed files
with
6 additions
and
4 deletions
| @@ -112,13 +112,15 @@ module Kanjai | @@ -112,13 +112,15 @@ module Kanjai | ||
| 112 | work_new_markers = item[:field_options].select{|item| item[:attributes]['repeatItemId'].to_s == repeat_id.to_s }.collect{|item| item[:name] } | 112 | work_new_markers = item[:field_options].select{|item| item[:attributes]['repeatItemId'].to_s == repeat_id.to_s }.collect{|item| item[:name] } |
| 113 | work_new_markers += item[:conditions].select{|item| item[:repeat_id].to_s == repeat_id.to_s }.collect{|item| item[:id] } | 113 | work_new_markers += item[:conditions].select{|item| item[:repeat_id].to_s == repeat_id.to_s }.collect{|item| item[:id] } |
| 114 | 114 | ||
| 115 | - #delete not exist more markers | ||
| 116 | - page_content.page_content_markers.where(lang: lang, row_item: index, parent_id: parent_id, repeat_id: repeat_id).where.not(marker: work_new_markers).delete_all | ||
| 117 | - | ||
| 118 | scope = {lang: lang, row_item: index, repeat_id: repeat_id, parent_id: parent_id} | 115 | scope = {lang: lang, row_item: index, repeat_id: repeat_id, parent_id: parent_id} |
| 119 | 116 | ||
| 120 | exist_markers = page_content.page_content_markers.where(scope).pluck(:marker) | 117 | exist_markers = page_content.page_content_markers.where(scope).pluck(:marker) |
| 121 | uuid = page_content.page_content_markers.where(scope).first.uuid | 118 | uuid = page_content.page_content_markers.where(scope).first.uuid |
| 119 | + | ||
| 120 | + #delete not exist more markers | ||
| 121 | + page_content.page_content_markers.where(lang: lang, row_item: index, parent_id: parent_id, repeat_id: repeat_id).where.not(marker: work_new_markers).delete_all | ||
| 122 | + | ||
| 123 | + | ||
| 122 | item[:field_options].select{|item| item[:attributes]['repeatItemId'] == repeat_id.to_s }.each do |marker| | 124 | item[:field_options].select{|item| item[:attributes]['repeatItemId'] == repeat_id.to_s }.each do |marker| |
| 123 | unless exist_markers.include?(marker[:name]) | 125 | unless exist_markers.include?(marker[:name]) |
| 124 | page_content.page_content_markers.create( | 126 | page_content.page_content_markers.create( |