From b7b61b72632ab0581cb588eef0428b62a77dd42d Mon Sep 17 00:00:00 2001 From: Alexander Diana Date: Thu, 2 Nov 2023 22:01:31 +0000 Subject: [PATCH] add schemamigration reason --- data/summary/summary.go | 6 +++++- data/summary/types/summary.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/data/summary/summary.go b/data/summary/summary.go index 43df4e310..1d14162af 100644 --- a/data/summary/summary.go +++ b/data/summary/summary.go @@ -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 diff --git a/data/summary/types/summary.go b/data/summary/types/summary.go index 0ce0bd534..61d1cc329 100644 --- a/data/summary/types/summary.go +++ b/data/summary/types/summary.go @@ -32,6 +32,7 @@ const ( OutdatedReasonUploadCompleted = "UPLOAD_COMPLETED" OutdatedReasonDataAdded = "DATA_ADDED" + OutdatedReasonSchemaMigration = "SCHEMA_MIGRATION" OutdatedReasonBackfill = "BACKFILL" )