Skip to content

Commit

Permalink
consider quater when checking overlapping tariff windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinRinas committed Jan 23, 2025
1 parent 38796ce commit f6655c8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/modules/electricity_tariffs/fixed_hours/tariff.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def validate_tariff_times(config):
for start, end in tariff["active_times"]["times"]:
start_time = to_time(start)
end_time = to_time(end)
for existing_start, existing_end in time_slots:
if (start_time < existing_end and end_time > existing_start):
for existing_start, existing_end, existing_quarters in time_slots:
if (start_time < existing_end and end_time > existing_start and
any(quarter in tariff["active_times"]["quarters"] for quarter in existing_quarters)):
raise ValueError(f"Overlapping time window detected: {start} - {end} in tariff '{tariff['name']}'")
time_slots.append((start_time, end_time))
time_slots.append((start_time, end_time, tariff["active_times"]["quarters"]))


def fetch(config: FixedHoursTariffConfiguration) -> None:
Expand Down

0 comments on commit f6655c8

Please sign in to comment.