dalsi pokusy
This commit is contained in:
@@ -661,17 +661,26 @@ def _pre_negative_sell_export_window(
|
||||
return first_neg, first_neg - 1
|
||||
|
||||
|
||||
def _prague_calendar_date(slot: PlanningSlot):
|
||||
dt = slot.interval_start
|
||||
if dt.tzinfo is None:
|
||||
dt = dt.replace(tzinfo=timezone.utc)
|
||||
return dt.astimezone(ZoneInfo("Europe/Prague")).date()
|
||||
|
||||
|
||||
def _pre_neg_peak_sell_idx(
|
||||
slots: list[PlanningSlot],
|
||||
first_neg_sell_idx: int | None,
|
||||
) -> int | None:
|
||||
"""Index slotu s nejvyšším kladným sell před prvním sell<0."""
|
||||
"""Nejvyšší kladný sell před prvním sell<0 ve stejném kalendářním dni (Prague)."""
|
||||
if first_neg_sell_idx is None or first_neg_sell_idx <= 0:
|
||||
return None
|
||||
neg_day = _prague_calendar_date(slots[first_neg_sell_idx])
|
||||
positive = [
|
||||
(i, float(slots[i].sell_price))
|
||||
for i in range(first_neg_sell_idx)
|
||||
if float(slots[i].sell_price) >= 0.0
|
||||
and _prague_calendar_date(slots[i]) == neg_day
|
||||
]
|
||||
if not positive:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user