mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-30 22:08:49 +01:00
Merge pull request #2086 from TracksApp/fix-top-10-longest-running
Fix the top 10 longest running projects list
This commit is contained in:
commit
0c18ebecc5
2 changed files with 4 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ module Stats
|
|||
|
||||
def find_top10_longest_running_projects
|
||||
projects = user.projects.order('created_at ASC')
|
||||
projects.sort_by{ |p| p.running_time }.take(10)
|
||||
projects.sort_by{ |p| p.running_time }.reverse.take(10)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ class StatsControllerTest < ActionController::TestCase
|
|||
assert_equal 4, totals.tags
|
||||
assert_equal 2, totals.unique_tags
|
||||
|
||||
longest_running_projects = assigns['stats'].projects.runtime
|
||||
assert_equal longest_running_projects, users(:admin_user).projects.order('created_at').reverse
|
||||
|
||||
Time.zone = users(:admin_user).prefs.time_zone # calculations are done in users timezone
|
||||
assert_equal 2.weeks.ago.at_midnight, totals.first_action_at.at_midnight
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue