revert order by change
This commit is contained in:
parent
e9d40ce466
commit
fe4cdfa0a4
4
db.go
4
db.go
|
@ -187,7 +187,7 @@ func (tdb *TelemDb) GetPackets(ctx context.Context, filter BusEventFilter, lim *
|
||||||
sb.WriteString(strings.Join(whereFrags, " AND "))
|
sb.WriteString(strings.Join(whereFrags, " AND "))
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.WriteString(" ORDER BY ts ASC")
|
sb.WriteString(" ORDER BY ts DESC")
|
||||||
|
|
||||||
// Augment our data further if there's i.e a limit modifier.
|
// Augment our data further if there's i.e a limit modifier.
|
||||||
// TODO: factor this out maybe?
|
// TODO: factor this out maybe?
|
||||||
|
@ -270,7 +270,7 @@ func (tdb *TelemDb) GetValues(ctx context.Context, filter BusEventFilter,
|
||||||
// join qstrings with AND
|
// join qstrings with AND
|
||||||
sb.WriteString(strings.Join(whereFrags, " AND "))
|
sb.WriteString(strings.Join(whereFrags, " AND "))
|
||||||
|
|
||||||
sb.WriteString(" ORDER BY ts ASC")
|
sb.WriteString(" ORDER BY ts DESC")
|
||||||
|
|
||||||
if lim != nil {
|
if lim != nil {
|
||||||
lim.ModifyStatement(&sb)
|
lim.ModifyStatement(&sb)
|
||||||
|
|
|
@ -203,9 +203,10 @@ func Test_ApiV1GetPackets(t *testing.T) {
|
||||||
t.Fatalf("response length did not match, want %d got %d", len(tt.expectedResults), len(resultEvents))
|
t.Fatalf("response length did not match, want %d got %d", len(tt.expectedResults), len(resultEvents))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note, the results are flipped here. We return earliest first.
|
||||||
for idx := range tt.expectedResults {
|
for idx := range tt.expectedResults {
|
||||||
expected := tt.expectedResults[idx]
|
expected := tt.expectedResults[idx]
|
||||||
actual := resultEvents[idx]
|
actual := resultEvents[len(resultEvents) - 1 - idx]
|
||||||
if !expected.Equals(&actual) {
|
if !expected.Equals(&actual) {
|
||||||
t.Errorf("packet did not match, want %v got %v", expected, actual)
|
t.Errorf("packet did not match, want %v got %v", expected, actual)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue