From e739dc77d739865fc083d88e54d83038d5d69d3c Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 10 Nov 2017 17:44:53 -0800 Subject: [PATCH] fixes #3359 --- app/logical/post_sets/most_viewed.rb | 2 +- app/logical/post_view_count_service.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/logical/post_sets/most_viewed.rb b/app/logical/post_sets/most_viewed.rb index a5320ed3a..2ec604375 100644 --- a/app/logical/post_sets/most_viewed.rb +++ b/app/logical/post_sets/most_viewed.rb @@ -3,7 +3,7 @@ module PostSets attr_reader :date def initialize(date) - @date = (date.blank? ? Time.zone.now : Time.zone.parse(date)).to_date + @date = date.blank? ? Date.today : Date.parse(date) end def posts diff --git a/app/logical/post_view_count_service.rb b/app/logical/post_view_count_service.rb index 14a173bd8..b0d7436d8 100644 --- a/app/logical/post_view_count_service.rb +++ b/app/logical/post_view_count_service.rb @@ -32,7 +32,7 @@ class PostViewCountService end def popular_posts(date = Date.today) - ranking = fetch_rank(date) + ranking = fetch_rank(date) || [] ranking.map {|x| Post.find(x[0])} end end