Fix cache bug.

This commit is contained in:
BoHung Chiu 2022-11-24 15:56:23 +08:00
parent 17bd45b6fc
commit 15800258da
2 changed files with 10 additions and 1 deletions

View File

@ -488,7 +488,7 @@ class EventNewsModsController < ApplicationController
first_postdate = event_news_for_locale.open_in_future.limit(1).pluck(:postdate)[0] first_postdate = event_news_for_locale.open_in_future.limit(1).pluck(:postdate)[0]
if @show_today_data_first if @show_today_data_first
sorted_event_news = sorted_event_news.reverse sorted_event_news = sorted_event_news.reverse
invalid_date = [first_postdate,first_deadline,Date.today.to_time].compact.sort[0] invalid_date = [first_postdate,first_deadline, (Date.today + 1.day).to_time].compact.sort[0]
else else
invalid_date = [first_postdate,first_deadline].compact.sort[0] invalid_date = [first_postdate,first_deadline].compact.sort[0]
end end

View File

@ -123,6 +123,15 @@ module EventNewsMod
rescue => e rescue => e
puts ['there_was_no_show_option_method',e] puts ['there_was_no_show_option_method',e]
end end
if File.basename($0) != 'rake'
begin
avoid_page_cache EventNewsCache
avoid_page_cache EventNewsFeedCache
avoid_page_cache EventNewsFeed
rescue => e
puts ["avoid_page_cache", e.to_s]
end
end
side_bar do side_bar do
head_label_i18n 'event_news.event_news', icon_class: "icons-megaphone" head_label_i18n 'event_news.event_news', icon_class: "icons-megaphone"
available_for "users" available_for "users"