diff --git a/core/bandmap/entries.go b/core/bandmap/entries.go index 0087991..e281dc7 100644 --- a/core/bandmap/entries.go +++ b/core/bandmap/entries.go @@ -311,7 +311,7 @@ func (l *Entries) insert(entry *Entry) { func (l *Entries) findIndexForInsert(entry *Entry) int { less := func(a, b *Entry) bool { - return l.order(a.BandmapEntry, b.BandmapEntry) + return l.order(b.BandmapEntry, a.BandmapEntry) } left := 0 right := len(l.entries) - 1 diff --git a/core/bandmap/entries_test.go b/core/bandmap/entries_test.go index 5cd96ca..d81e999 100644 --- a/core/bandmap/entries_test.go +++ b/core/bandmap/entries_test.go @@ -188,50 +188,50 @@ func TestEntries_findIndexForInsert(t *testing.T) { }, { desc: "before first", - fixture: []int{2, 3, 4}, - value: 1, + fixture: []int{4, 3, 2}, + value: 5, expected: 0, }, { desc: "at the first", - fixture: []int{2, 3, 4}, - value: 2, + fixture: []int{4, 3, 2}, + value: 4, expected: 0, }, { desc: "after the first", - fixture: []int{2, 4, 5}, - value: 3, + fixture: []int{5, 3, 2}, + value: 4, expected: 1, }, { desc: "at the center", - fixture: []int{2, 3, 5, 6}, + fixture: []int{6, 5, 3, 2}, value: 4, expected: 2, }, { desc: "at the existing center", - fixture: []int{2, 3, 4, 5, 6}, + fixture: []int{6, 5, 4, 3, 2}, value: 4, expected: 2, }, { desc: "before the last", - fixture: []int{2, 3, 5}, - value: 4, + fixture: []int{5, 4, 2}, + value: 3, expected: 2, }, { desc: "at the last", - fixture: []int{2, 3, 4}, - value: 4, + fixture: []int{4, 3, 1}, + value: 2, expected: 2, }, { desc: "after last", - fixture: []int{2, 3, 4}, - value: 5, + fixture: []int{4, 3, 2}, + value: 1, expected: 3, }, } @@ -269,50 +269,50 @@ func TestEntries_insert(t *testing.T) { }, { desc: "before first", - fixture: []int{2, 3, 4}, - value: 1, + fixture: []int{4, 3, 2}, + value: 5, expected: 0, }, { desc: "at the first", - fixture: []int{2, 3, 4}, - value: 2, + fixture: []int{4, 3, 2}, + value: 4, expected: 0, }, { desc: "after the first", - fixture: []int{2, 4, 5}, - value: 3, + fixture: []int{5, 3, 2}, + value: 4, expected: 1, }, { desc: "at the center", - fixture: []int{2, 3, 5, 6}, + fixture: []int{6, 5, 3, 2}, value: 4, expected: 2, }, { desc: "at the existing center", - fixture: []int{2, 3, 4, 5, 6}, + fixture: []int{6, 5, 4, 3, 2}, value: 4, expected: 2, }, { desc: "before the last", - fixture: []int{2, 3, 5}, - value: 4, + fixture: []int{5, 4, 2}, + value: 3, expected: 2, }, { desc: "at the last", - fixture: []int{2, 3, 4}, - value: 4, + fixture: []int{4, 3, 1}, + value: 2, expected: 2, }, { desc: "after last", - fixture: []int{2, 3, 4}, - value: 5, + fixture: []int{4, 3, 2}, + value: 1, expected: 3, }, } @@ -354,9 +354,10 @@ func TestEntries_CleanOutOldEntries(t *testing.T) { entries.Add(core.Spot{Call: callsign.MustParse("dl2abc"), Frequency: 3535500, Time: now.Add(-10 * time.Hour)}, now, defaultWeights) assert.Equal(t, 2, entries.Len()) - assert.Equal(t, "DL1ABC", entries.entries[0].Call.String()) - assert.Equal(t, 3, entries.entries[0].Len()) - assert.Equal(t, now.Add(-10*time.Minute), entries.entries[0].LastHeard) + assert.Equal(t, "DL2ABC", entries.entries[0].Call.String()) + assert.Equal(t, "DL1ABC", entries.entries[1].Call.String()) + assert.Equal(t, 3, entries.entries[1].Len()) + assert.Equal(t, now.Add(-10*time.Minute), entries.entries[1].LastHeard) entries.CleanOut(30*time.Minute, now, defaultWeights) diff --git a/ui/glade/contest.glade b/ui/glade/contest.glade index 8d4ead3..c5b6ff9 100644 --- a/ui/glade/contest.glade +++ b/ui/glade/contest.glade @@ -1812,7 +1812,7 @@ For more details see <a href="https://github.com/ftl/hellocontest/wiki/Main-W False Go to Next Spot Up True - + @@ -1821,7 +1821,7 @@ For more details see <a href="https://github.com/ftl/hellocontest/wiki/Main-W False Go to Next Spot Down True - +