Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix negative trend for calendar date #5487

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/collector/src/collector_utilities/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def days_ago(date_time: datetime) -> int:

def days_to_go(date_time: datetime) -> int:
"""Return the days remaining until the date/time."""
return (date_time - datetime.now(tz=date_time.tzinfo)).days
difference = (date_time - datetime.now(tz=date_time.tzinfo)).days
return difference if difference > 0 else 0
Sebastiaan127001 marked this conversation as resolved.
Show resolved Hide resolved


def is_regexp(string: str) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ async def test_time_remaining(self):
async def test_time_remaining_with_default(self):
"""Test the number of days without user-specified date."""
response = await self.collect()
self.assert_measurement(response, value=str((datetime(2021, 1, 1) - datetime.now()).days))
self.assert_measurement(response, value="0")
1 change: 1 addition & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ If your currently installed *Quality-time* version is v4.0.0 or older, please re

### Fixed

- Prevent negative time remaining in the calendar source. Fixes [#5267](https://github.com/ICTU/quality-time/issues/5267).
- Tags were not printed correctly in the reference manual. Fixes [#5282](https://github.com/ICTU/quality-time/issues/5282).
- Prevent users from entering negative desired response times. Fixes [#5328](https://github.com/ICTU/quality-time/issues/5328).

Expand Down