@@ -69,7 +69,7 @@ func (sb sortByIndex) Swap(i, j int) { sb[i], sb[j] = sb[j], sb[i] }
6969func (sb sortByIndex ) Less (i , j int ) bool {
7070 if sb [i ].Index == sb [j ].Index {
7171 // Same index: maintain insertion order (use timeStart as tiebreaker)
72- return sb [i ].timeStart .Before (sb [j ].timeStart )
72+ return sb [i ].timeStartValue () .Before (sb [j ].timeStartValue () )
7373 }
7474 return sb [i ].Index < sb [j ].Index
7575}
@@ -81,7 +81,7 @@ func (sb sortByIndexDsc) Swap(i, j int) { sb[i], sb[j] = sb[j], sb[i] }
8181func (sb sortByIndexDsc ) Less (i , j int ) bool {
8282 if sb [i ].Index == sb [j ].Index {
8383 // Same index: maintain insertion order (earlier timeStart first)
84- return sb [i ].timeStart .Before (sb [j ].timeStart )
84+ return sb [i ].timeStartValue () .Before (sb [j ].timeStartValue () )
8585 }
8686 // Reverse: higher index comes first
8787 return sb [i ].Index > sb [j ].Index
@@ -100,7 +100,7 @@ func (sb sortByPercent) Swap(i, j int) { sb[i], sb[j] = sb[j], sb[i] }
100100func (sb sortByPercent ) Less (i , j int ) bool {
101101 if sb [i ].PercentDone () == sb [j ].PercentDone () {
102102 // When percentages are equal, preserve insertion order (earlier timeStart first)
103- return sb [i ].timeStart .Before (sb [j ].timeStart )
103+ return sb [i ].timeStartValue () .Before (sb [j ].timeStartValue () )
104104 }
105105 return sb [i ].PercentDone () < sb [j ].PercentDone ()
106106}
@@ -112,7 +112,7 @@ func (sb sortByPercentDsc) Swap(i, j int) { sb[i], sb[j] = sb[j], sb[i] }
112112func (sb sortByPercentDsc ) Less (i , j int ) bool {
113113 if sb [i ].PercentDone () == sb [j ].PercentDone () {
114114 // When percentages are equal, preserve insertion order (earlier timeStart first)
115- return sb [i ].timeStart .Before (sb [j ].timeStart )
115+ return sb [i ].timeStartValue () .Before (sb [j ].timeStartValue () )
116116 }
117117 // Reverse: higher percentage comes first
118118 return sb [i ].PercentDone () > sb [j ].PercentDone ()
@@ -123,23 +123,27 @@ type sortByValue []*Tracker
123123func (sb sortByValue ) Len () int { return len (sb ) }
124124func (sb sortByValue ) Swap (i , j int ) { sb [i ], sb [j ] = sb [j ], sb [i ] }
125125func (sb sortByValue ) Less (i , j int ) bool {
126- if sb [i ].value == sb [j ].value {
127- return sb [i ].timeStart .Before (sb [j ].timeStart )
126+ valueI := sb [i ].Value ()
127+ valueJ := sb [j ].Value ()
128+ if valueI == valueJ {
129+ return sb [i ].timeStartValue ().Before (sb [j ].timeStartValue ())
128130 }
129- return sb [ i ]. value < sb [ j ]. value
131+ return valueI < valueJ
130132}
131133
132134type sortByValueDsc []* Tracker
133135
134136func (sb sortByValueDsc ) Len () int { return len (sb ) }
135137func (sb sortByValueDsc ) Swap (i , j int ) { sb [i ], sb [j ] = sb [j ], sb [i ] }
136138func (sb sortByValueDsc ) Less (i , j int ) bool {
137- if sb [i ].value == sb [j ].value {
139+ valueI := sb [i ].Value ()
140+ valueJ := sb [j ].Value ()
141+ if valueI == valueJ {
138142 // When values are equal, preserve insertion order (earlier timeStart first)
139- return sb [i ].timeStart .Before (sb [j ].timeStart )
143+ return sb [i ].timeStartValue () .Before (sb [j ].timeStartValue () )
140144 }
141145 // Reverse: higher value comes first
142- return sb [ i ]. value > sb [ j ]. value
146+ return valueI > valueJ
143147}
144148
145149type sortDsc struct { sort.Interface }
0 commit comments