thamara / time-to-leave

Log work hours and get notified when it's time to leave the office and start to live.
http://timetoleave.app
GNU General Public License v3.0
463 stars 271 forks source link

Removing entry pair in day view show redraw the balance of the day if entries are all complete #890

Closed araujoarthur0 closed 2 years ago

araujoarthur0 commented 2 years ago

Describe the issue In day view, when removing an entry pair, if there are enough entries filled to trigger a balance of the day, it should show up instead of needing a refresh.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Day View'
  2. Fill up 4 entries
  3. See the balance of the day
  4. Punch to add a new entry
  5. See the balance of the day disappear
  6. Remove the new entry pair
  7. You will not see the balance reappear. If you click to refresh, it will appear, though.

Environment

Version: 2.0.2-dev Electron: 11.5.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 OS: Windows_NT x64 10.0.22621

Screenshots balance

araujoarthur0 commented 2 years ago

The fix should be fairly simple, to call calendar._updateLeaveBy(); on the action that is triggered when removing entries. Would you like to try, @LouisHLAV?

LouisHLAV commented 2 years ago

Hey buddy! I'd love to :)

On a similar note, I'm wondering if the Month/Overall balance shouldn't also be updated on the addition or removal of valid entry pairs. But that's another issue hahaha

araujoarthur0 commented 2 years ago

Cool!

Also, I guess it makes sense. In month view I believe we always update them when a new time is punched. Take month view as the golden one.