Skip to content

Commit

Permalink
Make sure to only return hasOriginID if there are only origin.id fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
lostlevels committed Jul 11, 2024
1 parent ab2c4e0 commit 90975e3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions data/store/mongo/mongo_datum.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ func validateAndTranslateSelectors(selectors *data.Selectors) (filter bson.M, ha
if selector.ID != nil {
selectorIDs = append(selectorIDs, *selector.ID)
} else if selector.Origin != nil && selector.Origin.ID != nil {
hasOriginID = true
selectorOriginIDs = append(selectorOriginIDs, *selector.Origin.ID)
}
}
Expand All @@ -578,7 +577,7 @@ func validateAndTranslateSelectors(selectors *data.Selectors) (filter bson.M, ha
return nil, false, errors.New("selectors is invalid")
}

return selector, hasOriginID, nil
return selector, len(selectorOriginIDs) > 0 && len(selectorIDs) == 0, nil
}

func (d *DatumRepository) GetDataRange(ctx context.Context, userId string, typ []string, status *data.UserDataStatus) (*mongo.Cursor, error) {
Expand Down

0 comments on commit 90975e3

Please sign in to comment.