feat(analysis): _max_zero_streak su flag fetch_ok
This commit is contained in:
@@ -126,6 +126,19 @@ def _expected_ticks(since: datetime, until: datetime) -> int:
|
||||
return math.ceil(span_seconds / (_TICK_INTERVAL_MIN * 60))
|
||||
|
||||
|
||||
def _max_zero_streak(flags: list[int]) -> int:
|
||||
"""Longest run of consecutive zeros."""
|
||||
longest = 0
|
||||
current = 0
|
||||
for v in flags:
|
||||
if v == 0:
|
||||
current += 1
|
||||
longest = max(longest, current)
|
||||
else:
|
||||
current = 0
|
||||
return longest
|
||||
|
||||
|
||||
def _detect_gaps(timestamps: list[datetime]) -> tuple[GapRecord, ...]:
|
||||
"""Return gaps where consecutive timestamps differ by > threshold."""
|
||||
out: list[GapRecord] = []
|
||||
|
||||
Reference in New Issue
Block a user