summaryrefslogtreecommitdiff
path: root/stats/acts.go
diff options
context:
space:
mode:
Diffstat (limited to 'stats/acts.go')
-rw-r--r--stats/acts.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/stats/acts.go b/stats/acts.go
new file mode 100644
index 0000000..19c4219
--- /dev/null
+++ b/stats/acts.go
@@ -0,0 +1,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
+}