Skip to content

Commit

Permalink
refactor: add calculated_duration_s (player event)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrstrom committed Oct 30, 2024
1 parent f6afbdd commit 01c8b4b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion obr_core/stats/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ def player_event_pre_save(sender, instance, **kwargs):
return

if instance.state == "playing" and instance.time_end:
instance.calculated_duration_s = (instance.time_end - instance.time).total_seconds()
instance.calculated_duration_s = (
instance.time_end - instance.time
).total_seconds()
elif instance.state == "playing":
instance.calculated_duration_s = 0

Expand Down

0 comments on commit 01c8b4b

Please sign in to comment.