Fix JSON Changes
This commit is contained in:
parent
13cd41aa3f
commit
cf2312525d
12
sort.go
12
sort.go
@ -29,12 +29,12 @@ func (timerlist *TimerList) Sort(sortFlag int) error {
|
|||||||
default:
|
default:
|
||||||
return errors.New("Unrecognized sort option")
|
return errors.New("Unrecognized sort option")
|
||||||
}
|
}
|
||||||
timerlist.sortFlag = sortFlag
|
timerlist.SortFlag = sortFlag
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (timerlist *TimerList) refresh() {
|
func (timerlist *TimerList) refresh() {
|
||||||
timerlist.Sort(timerlist.sortFlag)
|
timerlist.Sort(timerlist.SortFlag)
|
||||||
for i, t := range timerlist.timers {
|
for i, t := range timerlist.Timers {
|
||||||
t.Id = i
|
t.Id = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,15 +45,15 @@ type timerlistSort struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ts *timerlistSort) Len() int {
|
func (ts *timerlistSort) Len() int {
|
||||||
return len(ts.timerlists.timers)
|
return len(ts.timerlists.Timers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *timerlistSort) Swap(l, r int) {
|
func (ts *timerlistSort) Swap(l, r int) {
|
||||||
ts.timerlists.timers[l], ts.timerlists.timers[r] = ts.timerlists.timers[r], ts.timerlists.timers[l]
|
ts.timerlists.Timers[l], ts.timerlists.Timers[r] = ts.timerlists.Timers[r], ts.timerlists.Timers[l]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *timerlistSort) Less(l, r int) bool {
|
func (ts *timerlistSort) Less(l, r int) bool {
|
||||||
return ts.by(ts.timerlists.timers[l], ts.timerlists.timers[r])
|
return ts.by(ts.timerlists.Timers[l], ts.timerlists.Timers[r])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (timerlist *TimerList) sortBy(by func(t1, t2 *Timer) bool) *TimerList {
|
func (timerlist *TimerList) sortBy(by func(t1, t2 *Timer) bool) *TimerList {
|
||||||
|
Loading…
Reference in New Issue
Block a user