diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 6c4b5b9..97b6c0d 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -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, diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index 42993a3..3551b60 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -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