Skip to main content

Module metrics

Module metrics 

Source
Expand description

Monthly shift counts and work/rest tracking.

All functions iterate day-by-day through the target range and call get_shift_type_for_date for each day.

Ported from Flutter shift_metrics.dart and Android shift_metrics.kt.

Functionsยง

consecutive_work_days
Count consecutive work days looking backward from today (inclusive).
count_shift_type_in_month
Count how many days of a given shift type occur in a month.
count_work_days_in_month
Count total working days (Morning + Afternoon + Night) in a month.
days_until_next_rest
Days until the next rest day, starting from tomorrow (excludes today).