-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Do not assign a y position to notes #3620
base: master
Are you sure you want to change the base?
Conversation
What gave me the idea that this was the solution was the existing note feature. Seeing that and knowing that note does not have the issue, I tried it with treatment note and tests showed that removing the y position from treatment note solved the problem for treatment note as well. |
I'm not too sure about this because it looks like you're removing the facility of notes being placed at particular points on the Y axis when the problem is that this position is encoded in the current units and if those change then the note positions become invalid. I feel like a better solution would be to detect notes which are outside of the currently selected unit range and scale those appropriately or to convert the Y positions in the database during a units change. I think the first option is likely preferable, as for example mmol would always be under 24 and mgdl always above it. |
Thanks for the review. But, why does this problem never occur for a note? It only occurs for a note attached to a treatment.
When I saw that this problem only occurred when I attach a note to a treatment, but does not when I just enter a note, I decided to see what the difference was. |
@jamorham Please see my post above. This PR only does what xDrip does already for notes. It's already been in xDrip for years and tested. Why can we not use it for notes attached to treatments as well? |
@jamorham I can do what you have suggested. But, will you do me a favor? Would you please tell me that you are aware that note (not treatment note) already does what this PR suggests and knowing that, you still prefer that I do what you have suggested? Thanks |
The y position is defined by the treatment. The note added to the treatment overrides that position in xDrip as is. This PR avoids impacting the position of the treatment when adding a note to it. |
Fixes: #1299
Recreate the problem
Install the latest Nightly (https://github.com/NightscoutFoundation/xDrip/releases/tag/2024.08.07).
Disable predictive simulations.
Set the BG units to mmol/L.
Enter an insulin treatment.
Tap on it and add a note. You should see something like this.
Change the BG unit setting to mg/dL. Now, you will see something like this.
You can see the y axis range has been expanded to very low values. Now, delete the treatment. You will see the scale going back to normal as shown below.
Enter a treatment again. Add a note to it. You should see something like this:
Change the BG unit to mmol/L. You will see this:
You can see that the y axis range is now unreasonably extended on the high side.
After this PR
The note will not have a y position value applied to them.
Let's repeat the second test. This is what you will see after entering a treatment and adding a note to it.
Now, if you change the BG unit, you will see this.
You can see that the y axis range remains reasonable.