diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 14bdf14..e5204d8 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -142,7 +142,13 @@ class AnnouncementsController < ApplicationController AnnsCache.create(parent_id: subpart.id.to_s,locale: I18n.locale.to_s,filter_result: anns) end else - anns = sorted_anns.sample(widget_data_count).map{|v| data_to_human_type(v)} + if devide_flag + anns = sorted_anns.sample(widget_data_count).map{|v| data_to_human_type(v)} + top_anns = anns.select{|v| v.is_top} + not_top_anns = anns.select{|v| !v.is_top} + else + anns = sorted_anns.sample(widget_data_count).map{|v| data_to_human_type(v)} + end end elsif devide_flag now_anns = anns_cache.first.filter_result