From def145d70d826dcfc03a05d15270ecdbda6949e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Thu, 25 May 2023 23:15:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=BE=A9member=5Fprofile=5Fid?= =?UTF-8?q?=E5=9E=8B=E6=85=8B=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/personal_journal/engine.rb | 49 ++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/lib/personal_journal/engine.rb b/lib/personal_journal/engine.rb index 423f8f7..e40977b 100644 --- a/lib/personal_journal/engine.rb +++ b/lib/personal_journal/engine.rb @@ -1,28 +1,37 @@ module PersonalJournal class Engine < ::Rails::Engine initializer "personal_journal" do - OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do - module_label 'module_name.journal_paper' - base_url File.expand_path File.dirname(__FILE__) - personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/personal_journal/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'PersonalJournal', :one_line_title => true, :field_modifiable => true, :analysis => true, :analysis_path => "/admin/journal_papers/analysis" + require File.expand_path('../../../app/models/journal_paper', __FILE__) + mp_id_maps = {} + JournalPaper.where({'member_profile_id.0'=> {'$exists'=> false}, 'member_profile_id' => {'$ne'=> nil}}).pluck(:id, :member_profile_id).each do |jpv| + mp_id_maps[jpv[1]] = [] if !mp_id_maps[jpv[1]] + mp_id_maps[jpv[1]] << jpv[0] + end + mp_id_maps.each do |mp_id, ids| + JournalPaper.where(:id.in => ids).update_all(member_profile_id: [mp_id]) + end + OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do + module_label 'module_name.journal_paper' + base_url File.expand_path File.dirname(__FILE__) + personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/personal_journal/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'PersonalJournal', :one_line_title => true, :field_modifiable => true, :analysis => true, :analysis_path => "/admin/journal_papers/analysis" - begin - page_custom_option({year: '<%= select_tag "#{f.object_name}[custom_data_field][year][]", options_for_select((1930...(DateTime.now.year+5)).to_a.reverse, (f.object.custom_data_field[:year].to_a rescue [])), {multiple: true} %>'}) - page_custom_option({journal_type: '<% JournalType.all.each do |journal_type| %><% end %>'}) - rescue => e - puts ['there_was_no_page_custom_option',e] - end - version "0.1" - desktop_enabled true - organization "Rulingcom" - author "RD dep" - intro "I am intro" - update_info 'some update_info' - frontend_enabled - icon_class_no_sidebar "icons-user" - data_count 1..10 + begin + page_custom_option({year: '<%= select_tag "#{f.object_name}[custom_data_field][year][]", options_for_select((1930...(DateTime.now.year+5)).to_a.reverse, (f.object.custom_data_field[:year].to_a rescue [])), {multiple: true} %>'}) + page_custom_option({journal_type: '<% JournalType.all.each do |journal_type| %><% end %>'}) + rescue => e + puts ['there_was_no_page_custom_option',e] + end + version "0.1" + desktop_enabled true + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + frontend_enabled + icon_class_no_sidebar "icons-user" + data_count 1..10 + end end - end end end