oliexdev / openScale

Open-source weight and body metrics tracker, with support for Bluetooth scales
GNU General Public License v3.0
1.68k stars 292 forks source link

Invisible (in the table and in charts) measurement #960

Closed makrzor closed 1 year ago

makrzor commented 1 year ago

Describe the bug There is an measurement, that is not visible in any of the views, but still if I try to add it again, the app complains, that there already exists a measurement having the same date and time.

To Reproduce

  1. Try to add a new entry with a specific date, time and values.
  2. Get a message that "There already exists a measurement with the same date and time. Screenshot_2023-06-03-09-25-18-87_0f6a5e28fc2dbe7e8c444cb63ec16665
  3. Nothing gets added.
  4. No entry is visible both in the Charts and in the Table view. Screenshot_2023-06-03-09-26-26-00_0f6a5e28fc2dbe7e8c444cb63ec16665 Screenshot_2023-06-03-09-25-36-95_0f6a5e28fc2dbe7e8c444cb63ec16665

Reproduced with [openScale v2.0.3 (44)]

Expected behavior A new record is added OR a record is visible with the date and time of failing record addition.

Additional context I'm not sure, how I got into this, but this was something with adding two entries, probably one somehow eclipsed the other and then removing the eclipsing one.

Debug log 2023-06-03 09:45:27.054 Debug [2] AboutPreferences: Debug log enabled, openScale v2.0.3 (44), SDK 31, OnePlus GM1913 2023-06-03 09:45:27.055 Debug [2] AboutPreferences: Selected user id(1) name(...) birthday(...) age(...) body height(170,00) scale unit(kg) gender(male) initial weight(77,70) goal weight(65,00) goal date(Sun Sep 20 00:00:00 GMT+02:00 2020) measure unt(cm) activity level(1) 2023-06-03 09:46:17.434 Debug [2] OpenScale: to be added measurement is thrown away because measurement with the same date and time already exist 2023-06-03 09:46:23.483 Debug [2] AboutPreferences: Debug log disabled

oliexdev commented 1 year ago

This is intended because some scales send always the whole measurements to the app. The deletion is not really done it just not visible anymore to avoid adding already deleted measurements again and again. So the timestamp must be unique.