Defect #4953 » timelog_controller.rb.diff
| app/controllers/timelog_controller.rb (working copy) | ||
|---|---|---|
|
@from = Date.today - 7 - (Date.today.cwday - 1)%7
|
||
|
@to = @from + 6
|
||
|
when '7_days'
|
||
|
@from = Date.today - 7
|
||
|
@from = Date.today - 6
|
||
|
@to = Date.today
|
||
|
when 'current_month'
|
||
|
@from = Date.civil(Date.today.year, Date.today.month, 1)
|
||
| ... | ... | |
|
@from = Date.civil(Date.today.year, Date.today.month, 1) << 1
|
||
|
@to = (@from >> 1) - 1
|
||
|
when '30_days'
|
||
|
@from = Date.today - 30
|
||
|
@from = Date.today - 29
|
||
|
@to = Date.today
|
||
|
when 'current_year'
|
||
|
@from = Date.civil(Date.today.year, 1, 1)
|
||
| test/functional/timelog_controller_test.rb (working copy) | ||
|---|---|---|
|
assert_template 'details'
|
||
|
assert_not_nil assigns(:entries)
|
||
|
assert_not_nil assigns(:total_hours)
|
||
|
assert_equal Date.today - 7, assigns(:from)
|
||
|
assert_equal Date.today - 6, assigns(:from)
|
||
|
assert_equal Date.today, assigns(:to)
|
||
|
end
|
||