mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 22:14:25 +01:00
G6: analytics averages quoted duration_s values (#1728)
gstack-skill-end writes duration_s as a quoted string, and the per-skill average stripped everything from the leading quote, so every average read 0s. The awk now drops a leading quote before extracting digits. Co-authored-by: Ryan Alberts <ryan.a.alberts@gmail.com>
This commit is contained in:
1 parent
427322d54c
commit
8051efcee0
2 files changed
+93
-1
No files matched your search
@@ -170,7 +170,9 @@ echo "$SKILL_COUNTS" | while read -r COUNT SKILL; do
|
||||
# Extract duration_s value using split on "duration_s":
|
||||
n = split($0, parts, "\"duration_s\":")
|
||||
if (n >= 2) {
|
||||
# parts[2] starts with the value, e.g. "142,"
|
||||
# parts[2] starts with the value: unquoted (142,...) or quoted ("142",...),
|
||||
# which gstack-skill-end writes. Strip a leading quote before the digits.
|
||||
sub(/^"/, "", parts[2])
|
||||
gsub(/[^0-9.].*/, "", parts[2])
|
||||
if (parts[2]+0 > 0) { total += parts[2]; count++ }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user