Skip to content

Conversation

@andig
Copy link
Member

@andig andig commented Jan 4, 2026

Fix #26164

@andig andig added the tariffs Specific tariff support label Jan 4, 2026
@andig andig marked this pull request as draft January 4, 2026 10:31
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The test cases use m=0 and d=0 when constructing time.Date, which will panic because Go months are 1–12 and days start at 1; adjust these to valid values (and, if needed, adjust expectations accordingly).
  • The slice tc := []struct{...}{...} and the loop variable for _, tc := range tc share the same name, which is confusing and shadows the outer variable; rename one of them for clarity.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The test cases use `m=0` and `d=0` when constructing `time.Date`, which will panic because Go months are 1–12 and days start at 1; adjust these to valid values (and, if needed, adjust expectations accordingly).
- The slice `tc := []struct{...}{...}` and the loop variable `for _, tc := range tc` share the same name, which is confusing and shadows the outer variable; rename one of them for clarity.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

clock := clock.NewMock()
at.(*Fixed).clock = clock

clock.Set(time.Date(2025, time.Month(tc.m), tc.d, 0, 0, 0, 0, time.UTC))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clock.Set(time.Date(2025, time.Month(tc.m), tc.d, 0, 0, 0, 0, time.UTC))
clock.Set(time.Date(2025, time.Month(tc.m), tc.d, 0, 0, 0, 0, time.Local))

richtig?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Muss einfach die gleiche Zeitzone sein wie die mack clock. Am besten von dort nehmen?

Copy link
Contributor

@iseeberg79 iseeberg79 Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

die Raten arbeiten wohl in Time.Local - dann wäre das richtig; bzw. auch die mock clock; soweit ich das finden konnte, wäre UTC hier falsch.

Wenn du also keinen konkreten Grund hast für UTC hier, nehmen wir besser Local.

Die Zeiten würden ansonsten "springen"... - hab einen Ansatz -> "wip"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…oder wir sorgen dafür, dass die Raten in der TZ der clock arbeiten, die dann normalerweise local sein sollte.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wird explizit eine "Reihenfolge" in der Spezifizierung der Tarife erwartet?
Hintergrund: wenn nein, braucht es eine Sortierung, die das berücksichtigt.

erlaubt:

  zones:
    - hours: 0-5, price: 0.20
    - hours: 0-5, months: Oct-Dec, price: 0.10
    - hours: 0-5, days: Mon-Fri, price: 0.15
    - hours: 0-5, months: Oct-Dec, days: Mon-Fri, price: 0.05
  zones:
    - hours: 0-5, price: 0.20
    - hours: 0-5, months: Oct-Dec, price: 0.22

nicht erlaubt (spezifischere Angabe zuerst):

  zones:
    - hours: 0-5, months: Oct-Dec, price: 0.22
    - hours: 0-5, price: 0.20

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angabe ist egal. Es sollte intern nach Spezifität sortiert werden.

@iseeberg79
Copy link
Contributor

wip in #26425, no write access

@andig andig closed this Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tariffs Specific tariff support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add charges / gridfee to grid type "fixed" / §14 Modul 3

3 participants