rozsireni o predpovidani posilani
This commit is contained in:
@@ -86,6 +86,21 @@ def minutes_to_hhmm(total: int) -> str:
|
||||
return f"{total // 60:02d}:{total % 60:02d}"
|
||||
|
||||
|
||||
def random_cfg_from_row(row) -> dict:
|
||||
"""Build a compute_fire_times config from a schedule_random DB row."""
|
||||
cfg = {
|
||||
"times_per_day": row["times_per_day"],
|
||||
"window": f"{minutes_to_hhmm(row['window_start'])}-{minutes_to_hhmm(row['window_end'])}",
|
||||
}
|
||||
if row["days_filter"]:
|
||||
cfg["days"] = row["days_filter"]
|
||||
if row["from_date"]:
|
||||
cfg["from"] = row["from_date"]
|
||||
if row["until_date"]:
|
||||
cfg["until"] = row["until_date"]
|
||||
return cfg
|
||||
|
||||
|
||||
def _minute_to_time(total_minutes: int) -> time:
|
||||
return time(total_minutes // 60, total_minutes % 60)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user