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

Status page transmitter days highlighted depending on the number of days #2160

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

Navid200
Copy link
Collaborator

@Navid200 Navid200 commented May 31, 2022

The transmitter days line on the system status page (for Dexcom) is highlighted if the transmitter is not resettable depending on how many days are left to the end of life.

If transmitter days is less than 69, or if the transmitter is resettable, the Transmitter Days line will be as is now.

Only if the transmitter is Firefly and is not modified, the color will change when the transmitter days is greater than 68.

Screenshot_20220530-193639

This serves as a reminder for the user to plan to order the next transmitter and plan the timing of the following sensors accordingly if the user intends to maximize the number of days they can use the transmitter.
It also highlights when no more sensors can be started.

This PR addresses the number 1 item from the three items identified here:
#2143 (comment)

I will open another PR shortly to address 2 from the same list.

@Navid200 Navid200 changed the title Transmitter days is highlighted depending on the number days Status page transmitter days is highlighted depending on the number of days May 31, 2022
@Navid200 Navid200 changed the title Status page transmitter days is highlighted depending on the number of days Status page transmitter days highlighted depending on the number of days May 31, 2022
@Navid200 Navid200 requested a review from jamorham May 31, 2022 11:51
@@ -2111,7 +2112,14 @@ public void run() {
l.add(new StatusItem("Transmitter Status", battery_status, BAD));
}

l.add(new StatusItem("Transmitter Days", parsedBattery.daysEstimate()));
if (vr != null && (FirmwareCapability.isTransmitterRawCapable(getTransmitterID())) || DexTimeKeeper.getTransmitterAgeInDays(tx_id) < 69) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a lot of code duplication here.

Can't you just pull the age in to a local variable and assign another variable for the highlight color based on which conditions are met and then add the status item a single time with the computed highlight?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, thanks. I will do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have made the changes you suggested.
Please tell me if anything else can be improved.
Thanks

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

Successfully merging this pull request may close these issues.

3 participants