Skip to content

Commit

Permalink
add schemamigration reason
Browse files Browse the repository at this point in the history
  • Loading branch information
Roukoswarf committed Nov 2, 2023
1 parent bcf85e7 commit b7b61b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data/summary/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ func (c *GlucoseSummarizer[T, A]) UpdateSummary(ctx context.Context, userId stri
}

// user has no usable summary for incremental update
if userSummary == nil || userSummary.Config.SchemaVersion != types.SchemaVersion {
if userSummary == nil {
userSummary = types.Create[T, A](userId)
}

if userSummary.Config.SchemaVersion != types.SchemaVersion {
userSummary.SetOutdated(types.OutdatedReasonSchemaMigration)
}

startTime := types.GetStartTime(userSummary, status)

var userData []*glucoseDatum.Glucose
Expand Down
1 change: 1 addition & 0 deletions data/summary/types/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (

OutdatedReasonUploadCompleted = "UPLOAD_COMPLETED"
OutdatedReasonDataAdded = "DATA_ADDED"
OutdatedReasonSchemaMigration = "SCHEMA_MIGRATION"
OutdatedReasonBackfill = "BACKFILL"
)

Expand Down

0 comments on commit b7b61b7

Please sign in to comment.