Skip to content
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

bug with datepicker for weight measurements #641

Open
Dieterbe opened this issue Sep 18, 2024 · 3 comments
Open

bug with datepicker for weight measurements #641

Dieterbe opened this issue Sep 18, 2024 · 3 comments

Comments

@Dieterbe
Copy link
Contributor

Dieterbe commented Sep 18, 2024

i have logged a weight entry today at 20:57:13
when i go to the "new entry" dialog, and tap on the calendar - so i can choose a new day (e.g. to log yesterday's weight) - it triggers this exception:

E/flutter (19174): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/material/date_picker.dart': Failed assertion: line 205 pos 5: 'selectableDayPredicate == null || initialDate == null || selectableDayPredicate(initialDate)': Provided initialDate 2024-09-18 00:00:00.000 must satisfy provided selectableDayPredicate.

why? because it uses selectableDayPredicate to only allow certain dates. while it does this:

                  // Always allow the current initial date
                  if (day == _weightEntry.date) {
                    return true;
                  }

this doesn't actually work because day is 2024-09-18 00:00:00.000 and _weightEntry.date is 2024-09-18 20:57:13.511178

since #633, we started logging values with non-0 hours/minutes/seconds

this brings up the question: should we allow logging multiple values within the same day (e.g. keep the hour-minute-second precision)? while probably not typically useful, i don't see much harm in it either. or are there other places (e.g. calendar, backend/python) where we make assumptions of "max once per day" ?

@Dieterbe
Copy link
Contributor Author

Dieterbe commented Nov 8, 2024

@rolandgeider can you let me know what you think of the question above?

@rolandgeider
Copy link
Member

no, there isn't really a deeper meaning for this besides that it doesn't make too much sense to log the weight several times per day. We could just allow it and remove all of these checks (we would need some small changes on the backend though)

@Dieterbe
Copy link
Contributor Author

Dieterbe commented Nov 8, 2024

i've been curious how my weight fluctuates during the day, but i agree it's not super relevant as a "feature".
but perhaps for other types of measurements it makes sense to measure more frequently (e.g. blood glucose levels), and we do want to make weight & measurements functions as similar as possible, and potentially even merge them later.

if it does not complicate the code (in fact, it may simplify it) to allow higher resolution & multi-per-day measurements, we should just allow them IMHO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants