docbrown/app/controllers/internal/dogfood_controller.rb
rhymes 1b60ee5009 Use timezone aware methods (#893)
* Use timezone aware datetime methods

* Use timezone aware date parse for GitHub issue tag

* Introduce a bit of chaos programming using Zonebie

Zonebie uses a random timezone to run tests, it's a really good way to see if the code is timezone dependent or not.

* Convert GitHub issue date as UTC
2018-10-18 16:26:29 -04:00

20 lines
669 B
Ruby

class Internal::DogfoodController < Internal::ApplicationController
layout "internal"
def index
usernames = if Rails.env.production?
["ben", "jess", "peter", "maestromac", "andy", "lianafelt"]
else
["thepracticaldev", "bendhalpern"]
end
@team_members = User.where(username: usernames).order(comments_count: :desc)
user_ids = @team_members.map(&:id)
@comment_totals_this_week = Comment.
users_with_number_of_comments(user_ids, Time.zone.today.beginning_of_week)
@comment_totals_24_hours = Comment.
users_with_number_of_comments(user_ids, 24.hours.ago)
end
end