From cc81f41a5747642864802b78521973d03b868395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Fri, 3 Mar 2023 22:00:53 +0800 Subject: [PATCH] fix tab --- lib/tasks/personal_journal.rake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/tasks/personal_journal.rake b/lib/tasks/personal_journal.rake index 3dd903c..83bfe0e 100644 --- a/lib/tasks/personal_journal.rake +++ b/lib/tasks/personal_journal.rake @@ -2,13 +2,13 @@ namespace :personal_journal do desc 'set_journal_type' task :set_journal_type => :environment do |task,args| JournalPaper.where(:rss2_id.ne=>nil).update_all({"$unset"=>{"journal_type_ids"=>""}}) - MemberTag.all.each do |mt| - journal_type = JournalType.where(:title=>mt.title).first - journal_type = JournalType.create(:title_translations=>mt.title_translations) if journal_type.nil? - journal_type_id = journal_type.id - journal_paper_ids = JournalPaper.where(:member_profile_id.in=>mt.member_profile_ids, :rss2_id.ne=>nil).pluck(:id) - JournalPaper.where(:id.in=>journal_paper_ids).update_all({"$addToSet"=>{"journal_type_ids"=>journal_type.id}}) - # JournalType.where(:id=>journal_type_id).update_all({"$addToSet"=>{"journal_paper_ids"=>{"$each"=>journal_paper_ids}}}) - end + MemberTag.all.each do |mt| + journal_type = JournalType.where(:title=>mt.title).first + journal_type = JournalType.create(:title_translations=>mt.title_translations) if journal_type.nil? + journal_type_id = journal_type.id + journal_paper_ids = JournalPaper.where(:member_profile_id.in=>mt.member_profile_ids, :rss2_id.ne=>nil).pluck(:id) + JournalPaper.where(:id.in=>journal_paper_ids).update_all({"$addToSet"=>{"journal_type_ids"=>journal_type.id}}) + # JournalType.where(:id=>journal_type_id).update_all({"$addToSet"=>{"journal_paper_ids"=>{"$each"=>journal_paper_ids}}}) + end end end \ No newline at end of file