Merge pull request 'Fix bug.' (#12) from 123/seminar:master into master

Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/12
This commit is contained in:
chiu 2023-04-12 04:36:54 +00:00
commit 2b3c4bbb6f
3 changed files with 22 additions and 6 deletions

View File

@ -333,7 +333,7 @@ class SeminarMain
page_part.sub_parts.where(kind: "module_widget",module: "custom_announcement").destroy
end
self.annc_count = 0
home_page.find_page(:page_id=>"news").update_all(:enabled_for=>[],:enabled_for_mobile=>[],:menu_enabled_for => [])
home_page.find_page(:page_id=>"news").update_all(:enabled_for=>[],:enabled_for_mobile=>false,:menu_enabled_for => [])
else
if page_part.nil?
page_part = home_page.page_parts.create(:part_id=>annc_part_id)
@ -345,7 +345,7 @@ class SeminarMain
data_count: annc_data_count,custom_data_field: {"bind_module_app"=>"seminar", "bind_uid"=>self.uid})
sub_part.select_options.create(annc_default_select_option_attr)
end
home_page.find_page(:page_id=>"news").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>@@in_use_locales,:menu_enabled_for => @@in_use_locales)
home_page.find_page(:page_id=>"news").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>true,:menu_enabled_for => @@in_use_locales)
end
self.save
end
@ -378,7 +378,7 @@ class SeminarMain
if page_part
page_part.sub_parts.where(kind: "module_widget",module: "custom_gallery").destroy
end
home_page.find_page(:page_id=>"album").update_all(:enabled_for=>[],:enabled_for_mobile=>[],:menu_enabled_for => [])
home_page.find_page(:page_id=>"album").update_all(:enabled_for=>[],:enabled_for_mobile=>false,:menu_enabled_for => [])
self.annc_count = 0
else
if page_part.nil?
@ -390,7 +390,7 @@ class SeminarMain
widget_type: "custom_gallery_widget2",widget_method: "widget",
data_count: album_data_count,custom_data_field: {"bind_module_app"=>"seminar", "bind_uid"=>self.uid})
end
home_page.find_page(:page_id=>"album").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>@@in_use_locales,:menu_enabled_for => @@in_use_locales)
home_page.find_page(:page_id=>"album").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>true,:menu_enabled_for => @@in_use_locales)
end
self.save
end

View File

@ -80,9 +80,9 @@ class SeminarTemplateSetting
end
end
if seminar_page.nil?
seminar_page = @seminar_page_root.child_page.create(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:enabled_for=>available_locales_tmp,:module=>page_module,:menu_enabled_for=>available_locales_tmp)
seminar_page = @seminar_page_root.child_page.create(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:enabled_for=>available_locales_tmp,:module=>page_module,:menu_enabled_for=>available_locales_tmp,:enabled_for_mobile=>true)
else
seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) if force_update
seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module,:enabled_for_mobile=>true) if force_update
end
end
return @seminar_page_root

View File

@ -10,6 +10,7 @@ Rails.application.routes.draw do
need_update1 = update_flag && !(s.tmp_flags.include?('fix_sr'))
need_update2 = !update_flag || !(s.tmp_flags.include?('smer1'))
need_update3 = !update_flag || !(s.tmp_flags.include?('smer2'))
need_update4 = !update_flag || !(s.tmp_flags.include?('smer3'))
if need_update1
Page.where(:bind_model=>"SeminarMain",:all_pageids=>nil).each do |p|
p.save
@ -32,6 +33,21 @@ Rails.application.routes.draw do
Site.update_all("$push"=>{"tmp_flags"=>'smer2'})
end
end
if need_update4
in_use_locales = s.in_use_locales.map(&:to_s)
Page.where(:parent_page_id.in=>SeminarMain.pluck(:id)).update_all(:enabled_for_mobile=>true, :menu_enabled_for=>in_use_locales, :enabled_for=>in_use_locales)
Page.where(:parent_page_id.in=>SeminarMain.pluck(:id)).each do |p|
p.find_page.each do |pp|
if pp[:enabled_for_mobile].class == Array
pp.enabled_for_mobile = pp[:enabled_for_mobile].present?
pp.save
end
end
end
if update_flag
Site.update_all("$push"=>{"tmp_flags"=>'smer3'})
end
end
end
SeminarSignupField.create_indexes
SeminarSubmissionField.create_indexes