Skip to content

Commit

Permalink
Fix the DN end datetime to be naive
Browse files Browse the repository at this point in the history
Signed-off-by: Aurélien Bompard <[email protected]>
  • Loading branch information
abompard committed Jun 3, 2024
1 parent 0c9f553 commit db83d57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fedbadges/cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def _year_split_query(self, **grep_kwargs):
def _first_message_timestamp(self, **grep_kwargs):
key = self._get_key(**grep_kwargs)
key = f"{key}|first_timestamp"
now = datetime.datetime.now(tz=datetime.timezone.utc)
get_first_kwargs = grep_kwargs.copy()
# remove grep() args that are not allowed by get_first()
for kwarg in ("defer", "rows_per_page", "page"):
Expand Down Expand Up @@ -193,7 +192,9 @@ def _get_first_timestamp(**kwargs):
if kwargs["start"] is None or start > kwargs["start"]:
kwargs["start"] = start
if kwargs["start"] is not None and "end" not in kwargs:
kwargs["end"] = now
# user creation time is naive, let's keep the end dt naive as well
# also, the datanommer column is currently naive, so, let's be consistent
kwargs["end"] = datetime.datetime.now()

log.debug("Getting first DN message for: %r", kwargs)
first_message = Message.get_first(**kwargs)
Expand Down

0 comments on commit db83d57

Please sign in to comment.