From e117ed781aef64f2c03c34d9ae54d6a31f445558 Mon Sep 17 00:00:00 2001 From: theirix Date: Sun, 27 Jun 2021 14:39:52 +0300 Subject: [PATCH] Handle last 2 weeks period --- app/models/timesheet.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/timesheet.rb b/app/models/timesheet.rb index a158a5c..c7ffbf8 100644 --- a/app/models/timesheet.rb +++ b/app/models/timesheet.rb @@ -130,6 +130,9 @@ def period=(period) when 'last_week' self.date_from = Date.today - 7 - (Date.today.cwday - 1)%7 self.date_to = self.date_from + 6 + when 'last_2_weeks' + self.date_from = Date.today - 14 - (Date.today.cwday - 1)%7 + self.date_to = self.date_from + 14 - 1 when '7_days' self.date_from = Date.today - 7 self.date_to = Date.today