Skip to content

Move the off option to the top of the manual override dropdowns - #5108

Open
springfall2008 wants to merge 1 commit into
mainfrom
feat/manual-select-off-first-5105
Open

springfall2008 wants to merge 1 commit into
mainfrom
feat/manual-select-off-first-5105

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

This is an automated draft PR generated from issue #5105 — a maintainer should review it before merging.

Fixes #5105

Summary

off was appended last in all three manual-override dropdown builders, so on a 48-hour list (~576 entries at 5-minute granularity) cancelling every override meant scrolling to the very bottom. It is now the first entry in manual_times(), manual_rates() and api_select_update() (apps/predbat/userinterface.py), which covers every select.predbat_manual_xxx control and the same lists as rendered in the web config page. The docs line that described off as being "at the bottom of the list" is updated to match.

Selection handling is unaffected: manual_select() / api_select() match on the value "off", never on its position, and nothing indexes item["options"] positionally.

Testing

  • ./run_pre_commit from coverage/ — all hooks passed, and the quick suite it runs afterwards passed in full (4 slow tests skipped).
  • tools/triage_test.sh manual_select with the userinterface.py change stashed — FAILS, flagging all three builders (ERROR: T10 Expected off to be the first option of manual_charge, got Tue 12:00 and the same for manual_import_rates and manual_api, plus T13 after a slot is selected).
  • tools/triage_test.sh manual_select with the change applied — PASSES.

The new test_off_option_first() in apps/predbat/tests/test_manual_select.py exercises one config item per builder, checks off is first and appears exactly once, and then checks it stays first once a slot is selected and still clears the selection.

Notes

  • impact() reports HIGH risk for all three methods, because they sit on initialize / update_time_loop / run_time_loop. That reflects where they live rather than this change: the return values and the state written by expose_config() are untouched, only the order of the presentation list item["options"] moves. detect_changes() shows the three methods and the test as the only changed symbols.
  • The three builders each end with the same if values not in time_values / item["options"] = / expose_config tail. That duplication predates this change and I left it alone rather than widening the diff into a refactor of code on the main loop.
  • While testing I noticed the dropdowns also carry an empty-string option (the values entry appended when nothing is selected — it renders as "None" in the web config page). That is pre-existing and outside what this ticket asked for, so it is untouched; with this change it now sits second in the list for manual_api.
  • The option-picking loop in the existing run_test_manual_select() was extracted into first_future_option() so the new test could reuse it rather than copy it — behaviour is unchanged (prefer a non-today day label, fall back to any selectable option).

@springfall2008 springfall2008 self-assigned this Sep 15, 2026
@springfall2008 springfall2008 added the BOT_REVIEW Trigger an autotriage label Sep 15, 2026
@springfall2008

Copy link
Copy Markdown
Owner Author

Automated review failed to complete for this PR - see the triage bot's logs for details. The run exited cleanly but posted nothing, so the review step itself did not complete. Not retrying automatically; remove BOT_FAILED and re-add BOT_REVIEW to try again.

@springfall2008 springfall2008 added BOT_FAILED An automated triage/PR attempt failed; see the comment for details and removed BOT_REVIEW Trigger an autotriage labels Sep 15, 2026
@springfall2008
springfall2008 requested a lite review from Copilot September 16, 2026 07:52
@springfall2008
springfall2008 marked this pull request as ready for review September 16, 2026 07:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are covered by documentation and regression tests with no unresolved blocking issues.

Pull request overview

Moves the off option to the top of manual override dropdowns for easier cancellation.

Changes:

  • Reorders options in all three dropdown builders.
  • Updates customization documentation.
  • Adds regression tests for ordering and selection behavior.
File summaries
File Description
docs/customisation.md Documents the new option position.
apps/predbat/userinterface.py Places off first in manual dropdown options.
apps/predbat/tests/test_manual_select.py Tests ordering and cancellation behavior.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BOT_FAILED An automated triage/PR attempt failed; see the comment for details

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: move 'off' option to start of the select.predbat_manual_xxx controls

2 participants