Browse Source

fix front page scope stat ordering.

master
Gisle Aune 2 years ago
parent
commit
a530bed697
  1. 1
      ports/mysql/stats.go
  2. 1
      usecases/scopes/result.go

1
ports/mysql/stats.go

@ -88,6 +88,7 @@ func (r *statsRepository) List(ctx context.Context, scopeIDs ...int) ([]entities
Select("id, scope_id, name, description, weight, allowed_amounts, is_primary").
From("stat").
Where(squirrel.Eq{"scope_id": scopeIDs}).
OrderBy("is_primary DESC", "name").
RunWith(r.db).
Query()
if err == sql.ErrNoRows {

1
usecases/scopes/result.go

@ -68,6 +68,7 @@ func generateResult(scope entities.Scope, members []entities.ScopeMember, stats
Owner: member.Owner,
}
}
if stats != nil {
res.Stats = make([]ResultStat, 0, len(stats))
for _, stat := range stats {

Loading…
Cancel
Save