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 272 forks source link

Empty database import updates overall balance #1068

Open kenziebourn opened 6 months ago

kenziebourn commented 6 months ago

Describe the issue A user can import a database which has an array of empty values, and the overall balance incorrectly updates.

To Reproduce Steps to reproduce the behavior:

  1. You can unzip and download the testdb.ttldb file provided or create one with the contents: [ { "type": "flexible", "date": "2023-05-21", "values": [] } ]
  2. Go to Edit > Import Database
  3. Upload testdb.ttldb file
  4. Scroll down to bottom
  5. See error image

Expected behavior When importing a database, I expected that the app would check for an array of empty values before validating, and fail if there is no values in the database file. And even if the app should accept empty values, the overall time balance shouldn't be affected since there is no times entered.

Environment testdb.zip

tupaschoal commented 6 months ago

Hi @kenziebourn, thanks for the bug report!

Out of curiosity, how did you end up with a date that has empty entries in the database?

kenziebourn commented 6 months ago

I created that test database file manually and made the date have empty entries

kenziebourn commented 6 months ago

Also if possible i'd like to be assigned to this issue

tupaschoal commented 5 months ago

Done