Text für Start des nächsten Zeitladen-Plans in Ladeprofil und Verbraucher - #3935
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Moderate findings remain in timeframe validation and both integration tests.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds German messages showing when the next scheduled time-charging plan starts for EV profiles and consumers.
Changes:
- Calculates upcoming starts for daily, weekly, and one-time plans.
- Formats German date/time messages.
- Integrates and tests the message in EV and consumer charging paths.
File summaries
| File | Summary |
|---|---|
packages/helpermodules/timecheck.py |
Calculates upcoming plan starts; complete timeframe validation is still needed. |
packages/helpermodules/timecheck_test.py |
Tests upcoming starts for supported plan frequencies. |
packages/control/text.py |
Formats German next-start messages. |
packages/control/ev/charge_template.py |
Displays the next-start message for EV charging. |
packages/control/ev/charge_template_test.py |
Moderate (1 vote): Patch the module-local formatter and assert a fixed sentinel. |
packages/control/consumer/consumer.py |
Displays the next-start message for consumers. |
packages/control/consumer/consumer_test.py |
Moderate (2 votes): Patch the module-local formatter and assert a fixed sentinel. |
Review details
Suppressed comments (2)
packages/control/ev/charge_template_test.py:96
format_next_time_charging_startis imported directly intocontrol.ev.charge_template, so patchingcontrol.textdoes not affect the function called byChargeTemplate.time_charging; the assertion also calls the patchedtextfunction. This test can therefore pass without verifying that production invokes the formatter. Patch the module-local symbol and assert a fixed sentinel instead.
monkeypatch.setattr(
text,
"format_next_time_charging_start",
Mock(return_value="Nächster Zeitladen-Plan startet am 02.01. um 14:30 Uhr."),
packages/helpermodules/timecheck.py:168
- This helper only parses the start field. A one-time plan whose end date is before its start (or whose end time is malformed) is rejected by
check_timeframe, but this branch still returns its future start; daily/weekly plans with invalid end times have the same problem. Validate the complete timeframe before returning a candidate, otherwise the UI can report a start for a plan that can never run.
start_hour, start_minute = _parse_plan_time(plan.time[0])
if plan.frequency.selected == "once":
begin_date = datetime.datetime.strptime(plan.frequency.once[0], "%Y-%m-%d")
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.