1
0

Fixed activity

This commit is contained in:
Jon Michael Aanes 2025-03-16 22:00:51 +01:00
parent e5b29f5a01
commit b690ffc51c

View File

@ -47,7 +47,7 @@ class RealizedActivitySample(ActivitySample):
def heuristically_realize_samples(
samples: list[ActivitySample],
default_estimated_duration: datetime.timedelta = DEFAULT_ESTIMATED_DURATION,
default_estimated_duration: datetime.timedelta | None = DEFAULT_ESTIMATED_DURATION,
) -> Iterator[RealizedActivitySample]:
"""Secret sauce.
@ -55,6 +55,9 @@ def heuristically_realize_samples(
* No samples overlap.
"""
if default_estimated_duration is None:
default_estimated_duration = DEFAULT_ESTIMATED_DURATION
samples.sort(key=lambda x: x.end_at)
previous_sample_end = None