Skip to content

Commit

Permalink
Short-circuit last_activity on unsaved FlowSession to avoid Django error
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Aug 28, 2024
1 parent 7d6585f commit 746c4ec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions course/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,9 @@ def answer_visits(self):
return assemble_answer_visits(self)

def last_activity(self) -> datetime.datetime | None:
if self.pk is None:
return None

for visit in (FlowPageVisit.objects
.filter(
flow_session=self,
Expand Down

0 comments on commit 746c4ec

Please sign in to comment.