##// END OF EJS Templates
Add "last 2 weeks" preset to time entries reporting (#11862)....
Jean-Philippe Lang -
r10372:3a178a42cfc0
parent child
Show More
@@ -308,6 +308,9 private
308 308 when 'last_week'
309 309 @from = Date.today - 7 - (Date.today.cwday - 1)%7
310 310 @to = @from + 6
311 when 'last_2_weeks'
312 @from = Date.today - 14 - (Date.today.cwday - 1)%7
313 @to = @from + 13
311 314 when '7_days'
312 315 @from = Date.today - 7
313 316 @to = Date.today
@@ -77,6 +77,7 module TimelogHelper
77 77 [l(:label_yesterday), 'yesterday'],
78 78 [l(:label_this_week), 'current_week'],
79 79 [l(:label_last_week), 'last_week'],
80 [l(:label_last_n_weeks, 2), 'last_2_weeks'],
80 81 [l(:label_last_n_days, 7), '7_days'],
81 82 [l(:label_this_month), 'current_month'],
82 83 [l(:label_last_month), 'last_month'],
@@ -663,6 +663,7 en:
663 663 label_yesterday: yesterday
664 664 label_this_week: this week
665 665 label_last_week: last week
666 label_last_n_weeks: "last %{count} weeks"
666 667 label_last_n_days: "last %{count} days"
667 668 label_this_month: this month
668 669 label_last_month: last month
@@ -653,6 +653,7 fr:
653 653 label_yesterday: hier
654 654 label_this_week: cette semaine
655 655 label_last_week: la semaine dernière
656 label_last_n_weeks: "les %{count} dernières semaines"
656 657 label_last_n_days: "les %{count} derniers jours"
657 658 label_this_month: ce mois-ci
658 659 label_last_month: le mois dernier
@@ -523,6 +523,13 class TimelogControllerTest < ActionController::TestCase
523 523 assert_equal '2011-12-11'.to_date, assigns(:to)
524 524 end
525 525
526 def test_index_last_2_week
527 Date.stubs(:today).returns('2011-12-15'.to_date)
528 get :index, :period => 'last_2_weeks'
529 assert_equal '2011-11-28'.to_date, assigns(:from)
530 assert_equal '2011-12-11'.to_date, assigns(:to)
531 end
532
526 533 def test_index_7_days
527 534 Date.stubs(:today).returns('2011-12-15'.to_date)
528 535 get :index, :period => '7_days'
General Comments 0
You need to be logged in to leave comments. Login now