-
Notifications
You must be signed in to change notification settings - Fork 4
Fix schedule creation UI: time defaults, picker binding, and level editing #945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: fredli74 <6632456+fredli74@users.noreply.github.com>
Co-authored-by: fredli74 <6632456+fredli74@users.noreply.github.com>
Co-authored-by: fredli74 <6632456+fredli74@users.noreply.github.com>
|
@copilot This statement makes no sense to me "Changed from now + 12h to now + 1h rounded to 10min intervals. The 12-hour offset caused past times when vehicles had been inactive." This math cannot end up with a result < Date.now(), yes? Math.ceil(Date.now() / 60e4) * 60e4 + 12 * 60 * 60e3 Also we do want the schedule 12h in the future, not 1h |
Co-authored-by: fredli74 <6632456+fredli74@users.noreply.github.com>
You're absolutely right - my analysis was incorrect. The math The actual bug was in Fixed in dc91e83: Now only uses the AI schedule time if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc91e83be7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async setLevel() { | ||
| this.localSchedule.level = this.levelSlider; | ||
| this.levelMenu = false; | ||
| await this.save(); | ||
| if (!this.newSchedule) { | ||
| await this.save(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep displayed level in sync with submitted value
For new schedules, setLevel now only mutates localSchedule and addSchedule submits that local state, but the template still renders {{ schedule.level }} from the prop, which is never updated for new items. This creates a mismatch where the UI shows the old percentage while the submitted schedule uses the new one, so users can unknowingly submit a different level than they see. Consider binding the display to localSchedule.level or syncing newSchedule when edits happen.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex update this branch with edits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Updated the schedule level button to display the locally edited value and added a computed fallback for new schedules to keep the UI in sync with submitted state. app/src/components/schedule-item.vueL41-L201
Testing
⚠️ Not run (not requested).
Screenshot
- Not captured (app not run).
|
Summary
Testing
|
Three related bugs in the schedule creation flow: default time showing past timestamps (e.g., "yesterday 16:40"), the datetime picker value wasn't captured on submit, and charge level slider changes were silently discarded.
Changes
Default time calculation: Fixed
onChangeSchedule()to only use AI schedule times if they're in the future. The bug was that when an AI schedule existed (e.g., from yesterday when the vehicle was asleep), it would overwrite the correct 12-hour default with a past timestamp. Now checksaiTime > Date.now()before using AI schedule time, otherwise keeps the 12-hour default.Datetime picker binding: Modified
schedule-item.vueto emitlocalScheduleon add, andvehicle-schedule.vueto accept it. Previously only the initial default time was sent regardless of picker changes.Charge level editing: Added newSchedule guard to
setLevel()andsetDateTime(). These methods calledsave()which early-returned for schedules without IDs, preventing local state updates. Changes now accumulate locally until submission.Code flow
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.