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

Download treatments originated from xDrip as well #3357

Merged
merged 3 commits into from
Feb 24, 2024

Conversation

Navid200
Copy link
Collaborator

We have two open issues related to the transfer of treatments to and from followers:
#735
#1196

This PR creates a workaround:

This PR will allow a follower to download treatments uploaded to Nightscout by the master.
It also allows the master to download treatments uploaded by the follower.

1- In order for the follower to be able to upload to Nightscout, Settings −> Cloud Upload −> Nightscout Sync −> Enabled must be set.
Also, Settings −> Cloud Upload −> Nightscout Sync −> Extra Options −> Upload treatments must be enabled.

2- For the master to download treatments, Settings −> Cloud Upload −> Nightscout Sync −> Download treatments must be enabled.


Tests

I have done a test with two test phones set up as a master and a follower confirming that treatments can be uploaded from either phone and the other phone would download it as well after this PR.

@Navid200
Copy link
Collaborator Author

This may be considered a conflict as how the follower needs to be set. It's hardware data source must be set to Nightscout follower. But, in order for it to be able to upload treatments to Nightscout, Nightscout sync also needs to be enabled.

One may wonder that the readings downloaded by the follower when then be uploaded again to Nightsocut.
My understanding is that Mongo will address such collisions.
So, there will be no issue on Nightscout.

If you ask me the following question, I cannot answer and will need to investigate if needed:
Will the follower use data to download and then again use data to upload the same data back to Nightscout? is that not a waste of data?

If this indeed is a concern, we will need to add a conditional to only upload treatments from a follower and not readings as well.

@jamorham
Copy link
Collaborator

I would suggest making it a preference switch for advanced option with defaulting to off so it can be merged for wider testing but I would think there could likely be a good reason for that duplicate checking being in there.

@Navid200
Copy link
Collaborator Author

That makes perfect sense. Thanks

@Navid200
Copy link
Collaborator Author

Navid200 commented Feb 22, 2024

I have added a switch. The following shows before and after of the main menu:

Before After
Screenshot_20240222-182641 Screenshot_20240222-181026

The following image shows the new submenu:
Screenshot_20240222-182326

@Navid200
Copy link
Collaborator Author

Tapping on download treatment takes you to a new submenu. There, you have the old download treatment checkbox. But, in addition to that, you will also see a new switch called skip items from xDrip. This new switch is enabled by default, which makes xDrip behave as it did before.

If you disable this switch, xDrip will also download treatments that have been uploaded to Nightscout by another xDrip.

I hope this is acceptable.


Tests

I have tested again two test phones acting as master and follower. Leaving the new switch enabled (default), xDrip behaves as before and does not download treatments from the other phone.
Disabling the new switch, either phone downloads treatments uploaded by the other phone.

@Navid200 Navid200 marked this pull request as draft February 23, 2024 17:09
@Navid200
Copy link
Collaborator Author

I have added the ability to set/unset the new setting in the follower menu as well.

Before After
Screenshot_20240223-130418 Screenshot_20240223-125925

@Navid200
Copy link
Collaborator Author

And this is the follower submenu:
Screenshot_20240223-130650

@Navid200 Navid200 marked this pull request as ready for review February 23, 2024 18:08
Copy link
Collaborator

@jamorham jamorham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@jamorham jamorham merged commit 72eb707 into NightscoutFoundation:master Feb 24, 2024
1 check passed
@Navid200
Copy link
Collaborator Author

Thanks

@Navid200 Navid200 deleted the Navid_2024_02_22 branch February 24, 2024 16:57
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

Successfully merging this pull request may close these issues.

2 participants