mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
parent
33c814e1b9
commit
d2931ea7f0
3 changed files with 19 additions and 1 deletions
|
@ -61,7 +61,7 @@ class ProjectsController < ApplicationController
|
||||||
@projects_to_review = projects.select {|p| p.needs_review?(current_user)}
|
@projects_to_review = projects.select {|p| p.needs_review?(current_user)}
|
||||||
@stalled_projects = projects.select {|p| p.stalled?}
|
@stalled_projects = projects.select {|p| p.stalled?}
|
||||||
@blocked_projects = projects.select {|p| p.blocked?}
|
@blocked_projects = projects.select {|p| p.blocked?}
|
||||||
@current_projects = current_user.projects.uncompleted.select {|p| not(p.needs_review?(current_user))}
|
@current_projects = projects.uncompleted.select { |p| not (p.needs_review?(current_user)) }.sort_by { |p| p.last_reviewed || Time.zone.at(0) }
|
||||||
|
|
||||||
init_not_done_counts(['project'])
|
init_not_done_counts(['project'])
|
||||||
init_project_hidden_todo_counts(['project'])
|
init_project_hidden_todo_counts(['project'])
|
||||||
|
|
|
@ -25,6 +25,16 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||||
assert_equal 2, assigns['deferred_todos'].size
|
assert_equal 2, assigns['deferred_todos'].size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_sorted_current_in_review
|
||||||
|
p = projects(:timemachine)
|
||||||
|
login_as :admin_user
|
||||||
|
get :review
|
||||||
|
current_projects = assigns['current_projects']
|
||||||
|
assert_equal 2, current_projects.length
|
||||||
|
assert_equal projects(:gardenclean), current_projects[0]
|
||||||
|
assert_equal projects(:moremoney), current_projects[1]
|
||||||
|
end
|
||||||
|
|
||||||
def test_show_exposes_next_project_in_same_state
|
def test_show_exposes_next_project_in_same_state
|
||||||
login_as :admin_user
|
login_as :admin_user
|
||||||
get :show, :id => projects(:timemachine).to_param
|
get :show, :id => projects(:timemachine).to_param
|
||||||
|
|
8
test/fixtures/projects.yml
vendored
8
test/fixtures/projects.yml
vendored
|
@ -6,6 +6,12 @@
|
||||||
def today
|
def today
|
||||||
Time.zone.now.utc.beginning_of_day.to_s(:db)
|
Time.zone.now.utc.beginning_of_day.to_s(:db)
|
||||||
end
|
end
|
||||||
|
def yesterday
|
||||||
|
1.day.ago.utc.beginning_of_day.to_s(:db)
|
||||||
|
end
|
||||||
|
def last_week
|
||||||
|
1.week.ago.utc.beginning_of_day.to_s(:db)
|
||||||
|
end
|
||||||
%>
|
%>
|
||||||
|
|
||||||
timemachine:
|
timemachine:
|
||||||
|
@ -28,6 +34,7 @@ moremoney:
|
||||||
user_id: 1
|
user_id: 1
|
||||||
created_at: <%= today %>
|
created_at: <%= today %>
|
||||||
updated_at: <%= today %>
|
updated_at: <%= today %>
|
||||||
|
last_reviewed: <%= yesterday %>
|
||||||
|
|
||||||
gardenclean:
|
gardenclean:
|
||||||
id: 3
|
id: 3
|
||||||
|
@ -38,6 +45,7 @@ gardenclean:
|
||||||
user_id: 1
|
user_id: 1
|
||||||
created_at: <%= today %>
|
created_at: <%= today %>
|
||||||
updated_at: <%= today %>
|
updated_at: <%= today %>
|
||||||
|
last_reviewed: <%= last_week %>
|
||||||
|
|
||||||
attendrailsconf:
|
attendrailsconf:
|
||||||
id: 4
|
id: 4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue