change map id to pluck to accelerate mapping

This commit is contained in:
chiu 2020-03-15 11:55:45 +08:00
parent 38022023e0
commit e9f21006b0
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ class AnnouncementsController < ApplicationController
if anns_cache.count > 1 if anns_cache.count > 1
anns_cache.destroy anns_cache.destroy
end end
AnnsCache.create(parent_id: subpart.id,locale: I18n.locale.to_s,filter_result: sorted_anns.map{|v| v.id}) AnnsCache.create(parent_id: subpart.id,locale: I18n.locale.to_s,filter_result: sorted_anns.pluck(:id))
else else
sorted_anns = sorted_anns.sample(widget_data_count) sorted_anns = sorted_anns.sample(widget_data_count)
end end