-
Notifications
You must be signed in to change notification settings - Fork 250
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
hamster/client: edit_activity: don't touch self.date on date changes #670
Conversation
The fact is recalculated already in on_start_date_change(). By calling the setter of self.date the fact would be change a second time. The start_date was then wrong by the delta. E.g. edit a complete fact (start and end must be set). Click on the start date and choose 2 days into the future, the command line shows now 4 days into the future. Fixes: projecthamster#667
Better fix, been pending for 9 months and a half: #597 (comment) |
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.
Thanks for the change and the fix - LGTM
I haven't looked closely at this PR yet, but it seems very simple and I recall (from earlier discussion and fix attempt in #630) that this code is quite complex with a lot of complex interactions. So I'm afraid that this simple fix might have unintended side effects. @benjaoming Did you also test this PR, or just reviewed the code? |
No, maybe @lynxis can reflect on the extend of how this is tested? Could letting a small change like this in to the |
I have tested this simple change. Tests in tests/test_stuff.py all pass. The coordination of cmdline and date pickers seems to work perfectly with this change. The left and right arrows also decrement and increment the dates properly in the cmdline and date pickers. Activities straddling the hamster start of day also seem okay. The only glitch I've found is that the day displayed on the timeline (hamsterday) doesn't get updated if the date is changed in the cmdline or start date picker, so the timeline display gets out of sync. This in turn affects whether or not the start date is displayed on the command line. Anyway, complements for the dramatic improvement in ability to edit facts on prior dates with such a minimal change. |
I've tested only a couple things in the edit_activity and see the update works correct.
|
The start_date is not displayed in the cmdline if it is the same as hamster day. |
One needs to be more precise, see #630 (comment): What makes sense is whether the start {civil date+time} is in a hamster day or not. The rule: hamster/src/hamster/lib/datetime.py Lines 439 to 441 in 0ba8407
|
Anything missing for a merge? |
Can someone say with confidence that it's an overall improvement? In that case, I think we should merge it. It certainly sounds like it's an overall improvement :) |
Had the fix been that simple, it would have been proposed earlier. |
I had another look at this issue. I considered (and even started somewhat) working on a more thorough refactor/cleanup that would fix this issue, but then realized that that would probably take quite some time to make and then also to get reviewed and merged, so that a small fix like in this PR would probably be better now, delaying the more thorough cleanup to later. Looking at this PR again, I realized that the problem is that the fact date is updated twice (once by The result is in a new PR, #674. @lynxis, @GeraldJansen, @benjaoming, would you care to have a look at that PR and let me know what you think? |
The fact is recalculated already in on_start_date_change(). By calling the setter of
self.date the fact would be change a second time. The start_date was then wrong by
the delta. E.g. edit a complete fact (start and end must be set). Click on the start date and choose 2 days into the future, the command line shows now 4 days into the future.
Fixes: #667