Skip to content

Commit

Permalink
adjust to new DBS Go server for lumis output
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Mar 22, 2022
1 parent 12589ce commit ea7b2a4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions services/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,29 @@ func OrderByRunLumis(records []mongo.DASRecord) []mongo.DASRecord {
var out []mongo.DASRecord
rmap := make(map[json.Number][]json.Number)
for _, r := range records {
lumiList := mongo.GetValue(r, "lumi.number").([]interface{})
var lumiList []json.Number
switch v := mongo.GetValue(r, "lumi.number").(type) {
case json.Number:
lumiList = append(lumiList, v)
case []interface{}:
for _, vv := range v {
lumiList = append(lumiList, vv.(json.Number))
}
}
// lumiList := mongo.GetValue(r, "lumi.number").([]interface{})
run := mongo.GetValue(r, "run.run_number").(json.Number)
lumis, ok := rmap[run]
if ok {
for _, v := range lumiList {
lumis = append(lumis, v.(json.Number))
// lumis = append(lumis, v.(json.Number))
lumis = append(lumis, v)
}
rmap[run] = lumis
} else {
var lumiValues []json.Number
for _, v := range lumiList {
lumiValues = append(lumiValues, v.(json.Number))
// lumiValues = append(lumiValues, v.(json.Number))
lumiValues = append(lumiValues, v)
}
rmap[run] = lumiValues
}
Expand Down

0 comments on commit ea7b2a4

Please sign in to comment.