From c1a8f932e9789c94bf269b50df1c7aca14ba9e91 Mon Sep 17 00:00:00 2001 From: jasder duan Date: Thu, 30 Nov 2023 16:24:08 +0800 Subject: [PATCH] =?UTF-8?q?ADD=20=E6=B7=BB=E5=8A=A0=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=9E=E8=B7=B5=E9=A1=B9=E7=9B=AE=E7=9A=84?= =?UTF-8?q?myshixun=5Fcount=20=E5=92=8Caverge=5Fstar=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/daily_update_star_for_shixun.rake | 2 +- lib/tasks/update_myshixuns_count_for_shixun.rake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/daily_update_star_for_shixun.rake b/lib/tasks/daily_update_star_for_shixun.rake index f002395d..1f874932 100644 --- a/lib/tasks/daily_update_star_for_shixun.rake +++ b/lib/tasks/daily_update_star_for_shixun.rake @@ -3,7 +3,7 @@ namespace :daily_update_star_for_shixun do desc "update star count every day for shixun " task :execute => :environment do - shixuns = Shixun.select("id, averge_star") + shixuns = Shixun.select("id, averge_star").order(updated_at: :desc) shixuns = shixuns.where(id: ENV['shixun_id']) if ENV['shixun_id'].present? shixuns.find_in_batches(batch_size: 10000) do |group| diff --git a/lib/tasks/update_myshixuns_count_for_shixun.rake b/lib/tasks/update_myshixuns_count_for_shixun.rake index fe4f3ef3..0720dd16 100644 --- a/lib/tasks/update_myshixuns_count_for_shixun.rake +++ b/lib/tasks/update_myshixuns_count_for_shixun.rake @@ -3,7 +3,7 @@ namespace :update_myshixuns_count_for_shixun do desc "update myshixuns count for shixun every day" task :execute => :environment do - shixuns = Shixun.joins(:myshixuns).select("shixuns.id, COUNT(myshixuns.id) AS query_myshixuns_count").group("shixuns.id") + shixuns = Shixun.joins(:myshixuns).select("shixuns.id, COUNT(myshixuns.id) AS query_myshixuns_count").group("shixuns.id").order("query_myshixuns_count DESC") shixuns = shixuns.where(id: ENV['shixun_id']) if ENV['shixun_id'].present? shixuns.find_in_batches(batch_size: 10000) do |group|