blob: 19c4219f561cfdb653d847f55f4ff55614696fd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package stats
import (
"slices"
"strings"
"sts2stats/model"
)
type Act struct {
Index int
Label string
Key string `db:"Key,primarykey"`
}
var actKeys []string
func EnrichActs(run model.Run, stat RunStat) (result []any, err error) {
for i, a := range run.Acts {
if slices.Contains(actKeys, a) {
continue
}
actKeys = append(actKeys, a)
act := Act{
Index: i,
Key: a,
Label: strings.SplitN(a, ".", 2)[0],
}
result = append(result, &act)
}
return result, nil
}
|