This commit is contained in:
BoHung Chiu 2023-03-26 10:54:05 +08:00
parent e774fccd55
commit 74b5257bc4
1 changed files with 32 additions and 8 deletions

View File

@ -34,7 +34,10 @@ class VideoProSetting
if post_agency_was.present?
video_image.title_translations.each do |k, v|
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
if v.present? && tmp2.include?(post_agency_was) && VideoImage.where(:id.ne=>video_image.id, :override_post_agency=>post_agency_was, :use_override_post_agency=>true).count == 0
save_flag = true
tmp2.delete(post_agency_was)
@ -45,7 +48,10 @@ class VideoProSetting
video_image.title_translations.each do |k, v|
if v.present?
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
save_flag = true
tmp2 << post_agency unless tmp2.include?(post_agency)
end
@ -61,7 +67,10 @@ class VideoProSetting
if user_id_was.present?
video_image.title_was.each do |k, v|
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
if v.present? && tmp2.include?(user_id_was) && VideoImage.where(:id.ne=>video_image.id, :update_user_id=>user_id_was, :use_override_post_agency=>false).count == 0
save_flag = true
tmp2.delete(user_id_was)
@ -71,7 +80,10 @@ class VideoProSetting
video_image.title_translations.each do |k, v|
if v.present?
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
save_flag = true
tmp2 << user_id unless tmp2.include?(user_id)
end
@ -90,7 +102,10 @@ class VideoProSetting
video_image.title_translations.each do |k, v|
if v.present?
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
save_flag = true
tmp2 << post_agency unless tmp2.include?(post_agency)
end
@ -103,7 +118,10 @@ class VideoProSetting
video_image.title_translations.each do |k, v|
if v.present?
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
save_flag = true
tmp2 << user_id unless tmp2.include?(user_id)
end
@ -120,7 +138,10 @@ class VideoProSetting
if post_agency.present?
video_image.title_translations.each do |k, v|
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
if v.present? && tmp2.include?(post_agency) && VideoImage.where(:id.ne=>video_image.id, :override_post_agency=>post_agency, :use_override_post_agency=>true).count == 0
save_flag = true
tmp2.delete(post_agency)
@ -133,7 +154,10 @@ class VideoProSetting
tmp = self.exist_user_ids_translations
video_image.title_translations.each do |k, v|
tmp2 = tmp[k]
tmp2 = [] if tmp2.nil?
if tmp2.nil?
tmp2 = []
tmp[k] = tmp2
end
if v.present? && tmp2.include?(user_id) && VideoImage.where(:id.ne=>video_image.id, :update_user_id=>user_id, :use_override_post_agency=>false).count == 0
save_flag = true
tmp2.delete(user_id)