Fix override banner in Live activity#653
Conversation
|
@dsnallfot @bjorkert @bjornoleh @flyingpie101 you guys are the override hardcore users. Let's go 🤓 |
|
I understand why you are adding an actual override date when the new override gets stored (based on your description of the issue and the intended fix). Why are you removing the duration helper function? No longer needed or mistakenly removed, @marv-out ? |
|
It wasn't in use. We apparently use a different one |
MikePlante1
left a comment
There was a problem hiding this comment.
Tested this in a simulator. I confirmed it fixes the problem of the OR banner in LA being hidden when a running OR is edited. I did not notice any adverse effects.
I also started a preset 10 min OR, edited the target after 6 minutes, and it expired 4 minutes later as expected.
I'll note that the Adjustments History page only shows the "Custom Override" for the full duration of the OR and does not show the initial preset, but that's the same as it is in current dev, so not anything introduced by this PR.
Further testing revealed a change when altering the duration of a running override. For example:
- Previously if you were 20 minutes into a 1 hour override and edited its duration to 10 minutes, the override would be cancelled. This PR makes it so it will continue to run for 10 minutes after the override was edited.
- Previously, if you were 20 minutes into a 1 hour override and edited its duration to 40 minutes, the override would continue for another 20 minutes (40-20). This PR makes it so it will continue to run for 40 minutes after the override was edited.
This only happens when you have a preset running and you edit the current running override. It does not happen when you edit a current running override that has already been edited. When editing a previously edited override, it acts as it does in current dev.
|
Ok I think this makes sense from looking at my changes. Hmmm, will have another look later how to avoid this behaviour |
|
I pushed a fix for the behaviour you described @MikePlante1. Pls test again! |
|
@MikePlante1 have you had the chance to test this again based on the comment by Marvin from July 2nd? |
MikePlante1
left a comment
There was a problem hiding this comment.
Re-tested with the latest code & now it LGTM
Fix override banner in Live activity
I've noticed that the LA banner disappears in the following situation:
Debugging this showed me that we are
Date()fixes this as this override will now be the latest override.I really hope that this PR doesn't break anything related to overrides, as this logic is pretty well tested and works. I don't think that this small change will cause any issues, but nevertheless, it needs to be tested thoroughly.