Skip to content

Commit

Permalink
include calculator type
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-bate committed Dec 13, 2023
1 parent 3281648 commit 9c077b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions migrations/20231128_jellyfish_migration/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import (
"github.com/tidepool-org/platform/data/types/blood/glucose/selfmonitored"
"github.com/tidepool-org/platform/data/types/blood/ketone"
"github.com/tidepool-org/platform/data/types/bolus"
"github.com/tidepool-org/platform/data/types/calculator"
"github.com/tidepool-org/platform/data/types/common"
"github.com/tidepool-org/platform/data/types/device"
"github.com/tidepool-org/platform/data/types/settings/pump"

"github.com/tidepool-org/platform/errors"
)

Expand Down Expand Up @@ -216,6 +218,17 @@ func datumHash(bsonData bson.M) (string, error) {
if err != nil {
return errorDebug(err)
}
case calculator.Type:
var calcDatum *calculator.Calculator
dataBytes, err := bson.Marshal(bsonData)
if err != nil {
return errorDebug(err)
}
bson.Unmarshal(dataBytes, &calcDatum)
identityFields, err = calcDatum.IdentityFields()
if err != nil {
return errorDebug(err)
}
}
if len(identityFields) == 0 {
return errorDebug(errors.New("missing identity fields"))
Expand Down

0 comments on commit 9c077b4

Please sign in to comment.