Skip to content

Conversation

@bjorkert
Copy link
Contributor

Solves: #242

This PR introduces significant improvements in the way our codebase handles date and time operations. I have consolidated multiple date-time-related functions into a single, more versatile function named getDateTimeString. This refactoring includes:

  • Replacing getCurrentDateTimeString, nowMinusNHoursTimeInterval, and nowMinus60DaysTimeInterval with a unified method.
  • Enhancing code maintainability and readability by reducing redundancy.
  • Allowing for greater flexibility in generating date-time strings, which can now easily handle both past and future dates.

Specifically, this new approach is leveraged to facilitate downloading of future carbohydrate entries (and other treatments) up to 6 hours ahead.

@marionbarker
Copy link
Collaborator

Question - should the carbs in future be plotted on the prediction plot?

Test Details

Display Carbs today at top of the information stack

With LoopFollow main branch,

  • Carbs today = 15 even though Loop uploaded 15 g at 07:37 (in the past) and 30 g at 12:42 (4 hours in the future)
  • Configure graph to show 4.5 hours of prediction
  • Carbs not plotted on prediction plot

Rebuild with changes from this PR:

  • Carbs today = 45
  • Carbs not plotted on prediction plot

@marionbarker
Copy link
Collaborator

marionbarker commented Dec 19, 2023

Future carbs are now plotted when the graph settings are increased.

  • Tested hours of prediction = 5
  • Entered future carbs 4 hours in future
    • they show up both in Carbs today and in the prediction plot
    • may need to drag the plot to the left to see the full prediction range

Tested the use of password for entering URL.

  • The URL and password are added to line from the password store
  • This works but is inconsistent with password needed for Loop, which is URL plus API_SECRET.
  • It would be convenient if URL would accept an embedded token (as supplied by clicking on access token in Nightscout).

But these modifications should be handled in a separate PR, not bundled with future-carbs.

@marionbarker marionbarker merged commit a16f79b into main Dec 20, 2023
@marionbarker marionbarker deleted the future-carbs branch December 20, 2023 17:53
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.

4 participants