Skip to content

Commit

Permalink
Merge branch 'main' into unsettled
Browse files Browse the repository at this point in the history
  • Loading branch information
elh committed Jun 30, 2023
2 parents 791540a + 2a975d7 commit 07b15b2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/app/bettor/repo/mem/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package mem
import (
"context"
"errors"
"sort"
"sync"

"github.com/bufbuild/connect-go" // too lazy to isolate errors. repo pkgs will return connect errors
Expand Down Expand Up @@ -64,6 +65,9 @@ func (r *Repo) CreateUser(_ context.Context, user *api.User) error {
}
}
r.Users = append(r.Users, user)
sort.SliceStable(r.Users, func(i, j int) bool {
return r.Users[i].Name < r.Users[j].Name
})
return nil
}

Expand Down Expand Up @@ -165,6 +169,9 @@ func (r *Repo) CreateMarket(_ context.Context, market *api.Market) error {
}
}
r.Markets = append(r.Markets, market)
sort.SliceStable(r.Markets, func(i, j int) bool {
return r.Markets[i].Name < r.Markets[j].Name
})
return nil
}

Expand Down Expand Up @@ -238,6 +245,9 @@ func (r *Repo) CreateBet(_ context.Context, bet *api.Bet) error {
}
}
r.Bets = append(r.Bets, bet)
sort.SliceStable(r.Bets, func(i, j int) bool {
return r.Bets[i].Name < r.Bets[j].Name
})
return nil
}

Expand Down

0 comments on commit 07b15b2

Please sign in to comment.