analysis/app: work around bug in SortBy
SortBy seems to sometimes sort by the second column instead of the
first. Until that bug is figured out, do the sorting one column at a
time to control the ordering.
Without this patch, try
/trend?q=upload%3A20170216.3+name%3ARegexpMatchEasy0_1K&raw=1
and
/trend?q=trend%3Abuild.golang.org%2Fwindows-amd64-gce+name%3AGzip+commit-time%3E2016-11-08+commit-time%3C2016-11-30&raw=1
The former seems to sort first by "commit" instead of "commit-time",
but the latter sorts by "commit-time" first. Apply the patch and both
are sorted by commit-time.
Change-Id: I8ebd2720fa1147fc1d468a6bab515a224537a98e
Reviewed-on: https://go-review.googlesource.com/37471
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/analysis/app/trend.go b/analysis/app/trend.go
index 9678442..9b47f6f 100644
--- a/analysis/app/trend.go
+++ b/analysis/app/trend.go
@@ -245,7 +245,11 @@
if opt.x == "" {
opt.x = "commit"
}
- t = table.SortBy(t, "commit-time", opt.x)
+ // TODO(quentin): One SortBy call should do this, but
+ // sometimes it seems to sort by the second column instead of
+ // the first. Do them in separate steps until SortBy is fixed.
+ t = table.SortBy(t, opt.x)
+ t = table.SortBy(t, "commit-time")
t = colIndex{col: opt.x}.F(t)
// Unpivot all of the metrics into one column.