fix bug for anns cache

This commit is contained in:
chiu committed 2021-08-05 18:19:42 +08:00
1 parent 427222df41
commit 6ff4eecbc1
3 files changed
+20 -11

No files matched your search

+1
View File
@@ -3,4 +3,5 @@ class AnnsCache
field :parent_id
field :filter_result
field :locale,type: String,default: 'zh_tw'
field :invalid_date, type: DateTime
end
+3 -2
View File
@@ -78,9 +78,10 @@ class Bulletin
before_destroy :destroy_email
scope :can_display_and_sorted, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lte=>Time.now, :deadline.gte=>Time.now},{:postdate.lte=>Time.now, :deadline=>nil},{:postdate=>nil}).order(is_top: :desc,postdate: :desc,id: :desc)}
scope :open_in_future, ->{where(:is_hidden.ne=>true,:is_preview.ne => true,:postdate.gt=>Time.now).order(postdate: :asc)}
scope :can_display_and_sorted, ->{where(:is_hidden.ne=>true,:is_preview.ne => true).any_of({:postdate.lte=>Time.now, :deadline.gte=>Time.now},{:postdate.lte=>Time.now, :deadline=>nil},{:postdate=>nil}).order(is_top: :desc,postdate: :desc,id: :desc)}
scope :is_approved, ->{where(:approved => true)}
scope :filter_cats_and_tags, ->(cats,tags) {filter_by_widget_categories(cats,false).filter_by_tags(tags)}
before_create :set_expire
before_save :check_limit
def to_calendar_param