This commit is contained in:
BoHung Chiu 2021-04-11 22:08:27 +08:00
parent ba07aadf15
commit d5e03a1fd9
2 changed files with 2 additions and 2 deletions

View File

@ -688,7 +688,7 @@ class AnnouncementsController < ApplicationController
"title" => announcement["title_translations"][locale],
"subtitle_ann" => subtitle_ann,
"update_user" => update_user,
"updated_at" => datetime.in_time_zone(Time.zone.utc_offset / 3600).strftime('%Y-%m-%d %H:%M'),
"updated_at" => (datetime.in_time_zone(Time.zone.utc_offset / 3600).strftime('%Y-%m-%d %H:%M') rescue ""),
"body" => announcement["text_translations"][locale],
"image" => announcement["image"]["original"],
"img_src" => img_src,

View File

@ -76,7 +76,7 @@ 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}).order(is_top: :desc,postdate: :desc,id: :desc)}
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 :is_approved, ->{where(:approved => true)}
before_create :set_expire