Skip to content

Commit

Permalink
Merge pull request #1869 from RomainFayolle/hotfix-second_in_calc
Browse files Browse the repository at this point in the history
add second=0 or 59 in calc for month range in current_month_tomatoes
  • Loading branch information
RignonNoel authored Mar 31, 2023
2 parents 1929dce + 0519559 commit 0495543
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions blitz_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ def tomato_field_matrix(self):
def current_month_tomatoes(self):
today = timezone.now()
first_day = today.replace(
day=1, hour=0, minute=0, microsecond=0
day=1, hour=0, minute=0, second=0, microsecond=0
)
day = calendar.monthrange(today.year, today.month)[1]
last_day = today.replace(
day=day, hour=23, minute=59, microsecond=999999
day=day, hour=23, minute=59, second=59, microsecond=999999
)
nb_tomatoes = Tomato.objects.filter(
user=self,
Expand Down
4 changes: 2 additions & 2 deletions tomato/tests/tests_viewset_Tomato.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,11 @@ def test_filter_acquisition_date_as_user(self):
"""
today = timezone.now()
first_day = today.replace(
day=1, hour=0, minute=0, microsecond=0
day=1, hour=0, minute=0, second=0, microsecond=0
)
day = calendar.monthrange(today.year, today.month)[1]
last_day = today.replace(
day=day, hour=23, minute=59, microsecond=999999
day=day, hour=23, minute=59, second=59, microsecond=999999
)
next_month = today + timedelta(days=31)
last_month = today - timedelta(days=31)
Expand Down

0 comments on commit 0495543

Please sign in to comment.