Skip to content

Commit

Permalink
fix(gluwave): 🩹 no prediction if no recent insulin data #172
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalhama committed Oct 8, 2024
1 parent 8070dd9 commit 2d12e60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gluwave/src/server/services/iob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const inuslin_on_board = async (
start: Date,
end: Date
) => {
const insunlin = await db
const i = await db
.select()
.from(insulin)
.where(
Expand All @@ -36,8 +36,8 @@ export const inuslin_on_board = async (
// Convert meals array to a Polars DataFrame
const insulinDF = pl.DataFrame(
{
timestamp: insunlin.map((m) => m.timestamp),
insulin: insunlin.map((m) => m.amount),
timestamp: i.map((m) => m.timestamp).concat([new Date()]), // push dummy element to ensure there is always at least one
insulin: i.map((m) => m.amount).concat([0]),
},
{
schema: {
Expand Down

0 comments on commit 2d12e60

Please sign in to comment.