Round overlap resolution midpoint to nearest 5 minutes
This commit is contained in:
parent
de46399010
commit
b2b45fd4e1
2 changed files with 48 additions and 1 deletions
|
|
@ -273,6 +273,11 @@ def _minutes_to_time(minutes: int) -> str:
|
|||
return f"{minutes // 60:02d}:{minutes % 60:02d}"
|
||||
|
||||
|
||||
def _round_to_5(minutes: int) -> int:
|
||||
"""Round minutes to the nearest 5-minute boundary."""
|
||||
return round(minutes / 5) * 5
|
||||
|
||||
|
||||
def _make_closed_row(template: dict, start_m: int, end_m: int) -> dict | None:
|
||||
"""
|
||||
Return a copy of *template* with updated start, end, and duration_hours.
|
||||
|
|
@ -330,7 +335,7 @@ def resolve_overlaps(rows: list[dict]) -> list[dict]:
|
|||
if overlap_end_m <= b_start_m:
|
||||
continue
|
||||
|
||||
midpoint_m = (b_start_m + overlap_end_m) // 2
|
||||
midpoint_m = _round_to_5((b_start_m + overlap_end_m) // 2)
|
||||
replacements: list[dict] = []
|
||||
|
||||
if b_end_m <= a_end_m:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue