Skip to content

Commit

Permalink
convert to BolusMap
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-bate committed Dec 19, 2023
1 parent 3061540 commit e1939df
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions migrations/20231128_jellyfish_migration/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ func updateIfExistsPumpSettingsSleepSchedules(bsonData bson.M) (*pump.SleepSched

func updateIfExistsPumpSettingsBolus(bsonData bson.M) (*pump.BolusMap, error) {
if bolus := bsonData["bolus"]; bolus != nil {
boluses, ok := bolus.(*pump.BolusMap)
if !ok {
return nil, errors.Newf("data %v is not the expected boluses type", bolus)
boluses := pump.BolusMap{}
dataBytes, err := json.Marshal(bolus)
if err != nil {
return nil, err
}
err = json.Unmarshal(dataBytes, &boluses)
if err != nil {
return nil, err
}
return boluses, nil
return &boluses, nil
}
return nil, nil
}
Expand Down

0 comments on commit e1939df

Please sign in to comment.