Skip to content

Commit

Permalink
sort habits by name
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofnds committed Nov 27, 2022
1 parent 31689d1 commit 928c48e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions habit/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ func (d *client) GroupsAndHabits() ([]*Group, []*Habit, error) {
return nil, nil, err
}

sort.SliceStable(data.Habits, func(i, j int) bool {
return data.Habits[i].Name < data.Habits[j].Name
})

for _, h := range data.Habits {
sortActivities(h.Activities)
}
Expand Down

0 comments on commit 928c48e

Please sign in to comment.