@@ -17,6 +17,7 @@ import (
1717 "fyne.io/fyne/v2/theme"
1818 "fyne.io/fyne/v2/widget"
1919 kxwidget "github.com/ErikKalkoken/fyne-kx/widget"
20+ "github.com/dustin/go-humanize"
2021
2122 "github.com/ErikKalkoken/evebuddy/internal/app"
2223 ihumanize "github.com/ErikKalkoken/evebuddy/internal/humanize"
@@ -107,12 +108,12 @@ type training struct {
107108const (
108109 trainingColName = 0
109110 trainingColTags = 1
110- trainingColCurrent = 2
111+ trainingColCurrentSkill = 2
111112 trainingColCurrentRemaining = 3
112- trainingColTotal = 4
113- trainingColTotalRemaining = 5
114- trainingColSP = 6
115- trainingColUnallocated = 7
113+ trainingColQueuedCount = 4
114+ trainingColQueuedRemaining = 5
115+ trainingColSkillpoints = 6
116+ trainingColUnallocatedSP = 7
116117)
117118
118119func newTraining (u * baseUI ) * training {
@@ -126,29 +127,26 @@ func newTraining(u *baseUI) *training {
126127 Width : 150 ,
127128 NoSort : true ,
128129 }, {
129- Col : trainingColCurrent ,
130+ Col : trainingColCurrentSkill ,
130131 Label : "Current Skill" ,
131132 Width : 250 ,
132133 }, {
133134 Col : trainingColCurrentRemaining ,
134- Label : "Current Remaining" ,
135- Width : 0 ,
135+ Label : "Current Time" ,
136136 }, {
137- Col : trainingColTotal ,
137+ Col : trainingColQueuedCount ,
138138 Label : "Queued" ,
139- Width : 0 ,
140139 }, {
141- Col : trainingColTotalRemaining ,
142- Label : "Queue Remaining" ,
143- Width : 0 ,
140+ Col : trainingColQueuedRemaining ,
141+ Label : "Queue Time" ,
144142 }, {
145- Col : trainingColSP ,
143+ Col : trainingColSkillpoints ,
146144 Label : "SP" ,
147- Width : 50 ,
145+ Width : 100 ,
148146 }, {
149- Col : trainingColUnallocated ,
147+ Col : trainingColUnallocatedSP ,
150148 Label : "Unall." ,
151- Width : 50 ,
149+ Width : 100 ,
152150 }})
153151 a := & training {
154152 columnSorter : headers .NewColumnSorter (trainingColName , iwidget .SortAsc ),
@@ -165,22 +163,22 @@ func newTraining(u *baseUI) *training {
165163 case trainingColTags :
166164 s := strings .Join (slices .Sorted (r .tags .All ()), ", " )
167165 return iwidget .RichTextSegmentsFromText (s )
168- case trainingColCurrent :
166+ case trainingColCurrentSkill :
169167 return r .skillDisplay
170168 case trainingColCurrentRemaining :
171169 return iwidget .RichTextSegmentsFromText (r .currentRemainingTimeString ())
172- case trainingColTotal :
170+ case trainingColQueuedCount :
173171 return iwidget .RichTextSegmentsFromText (r .totalRemainingCountDisplay )
174- case trainingColTotalRemaining :
172+ case trainingColQueuedRemaining :
175173 return iwidget .RichTextSegmentsFromText (r .totalRemainingTimeString ())
176- case trainingColSP :
174+ case trainingColSkillpoints :
177175 return iwidget .RichTextSegmentsFromText (
178176 r .totalSPDisplay ,
179177 widget.RichTextStyle {
180178 Alignment : fyne .TextAlignTrailing ,
181179 },
182180 )
183- case trainingColUnallocated :
181+ case trainingColUnallocatedSP :
184182 return iwidget .RichTextSegmentsFromText (
185183 r .unallocatedSPDisplay ,
186184 widget.RichTextStyle {
@@ -315,12 +313,12 @@ func (a *training) makeDataList() *iwidget.StripedList {
315313 queueRemaining .Refresh ()
316314
317315 b3 := vbox [4 ].(* fyne.Container ).Objects
318- b3 [0 ].(* widget.Label ).SetText (r .totalSPDisplay + " total SP" )
316+ b3 [0 ].(* widget.Label ).SetText (r .totalSPDisplay + " SP" )
319317 unallocated := b3 [1 ].(* widget.Label )
320318 if r .unallocatedSP .ValueOrZero () == 0 {
321319 unallocated .Text = ""
322320 } else {
323- unallocated .Text = r . unallocatedSPDisplay + " unallocated SP"
321+ unallocated .Text = fmt . Sprintf ( "unalloc: %s SP", r . unallocatedSPDisplay )
324322 }
325323 unallocated .Refresh ()
326324 },
@@ -364,15 +362,15 @@ func (a *training) filterRows(sortCol int) {
364362 x = xstrings .CompareIgnoreCase (a .characterName , b .characterName )
365363 case trainingColCurrentRemaining :
366364 x = cmp .Compare (a .currentRemainingTime ().ValueOrZero (), b .currentRemainingTime ().ValueOrZero ())
367- case trainingColCurrent :
365+ case trainingColCurrentSkill :
368366 x = strings .Compare (a .skillName , b .skillName )
369- case trainingColTotal :
367+ case trainingColQueuedCount :
370368 x = cmp .Compare (a .totalRemainingCount .ValueOrZero (), b .totalRemainingCount .ValueOrZero ())
371- case trainingColTotalRemaining :
369+ case trainingColQueuedRemaining :
372370 x = cmp .Compare (a .totalRemainingTime ().ValueOrZero (), b .totalRemainingTime ().ValueOrZero ())
373- case trainingColSP :
371+ case trainingColSkillpoints :
374372 x = cmp .Compare (a .totalSP .ValueOrZero (), b .totalSP .ValueOrZero ())
375- case trainingColUnallocated :
373+ case trainingColUnallocatedSP :
376374 x = cmp .Compare (a .unallocatedSP .ValueOrZero (), b .unallocatedSP .ValueOrZero ())
377375 }
378376 if dir == iwidget .SortAsc {
@@ -436,12 +434,16 @@ func (*training) fetchRows(s services) ([]trainingRow, error) {
436434 continue
437435 }
438436 r := trainingRow {
439- characterID : c .ID ,
440- characterName : c .EveCharacter .Name ,
441- totalSP : c .TotalSP ,
442- totalSPDisplay : ihumanize .Optional (c .TotalSP , "?" ),
443- unallocatedSP : c .UnallocatedSP ,
444- unallocatedSPDisplay : ihumanize .Optional (c .UnallocatedSP , "?" ),
437+ characterID : c .ID ,
438+ characterName : c .EveCharacter .Name ,
439+ totalSP : c .TotalSP ,
440+ totalSPDisplay : c .TotalSP .StringFunc ("?" , func (v int ) string {
441+ return humanize .Comma (int64 (v ))
442+ }),
443+ unallocatedSP : c .UnallocatedSP ,
444+ unallocatedSPDisplay : c .UnallocatedSP .StringFunc ("?" , func (v int ) string {
445+ return humanize .Comma (int64 (v ))
446+ }),
445447 }
446448 tags , err := s .cs .ListTagsForCharacter (ctx , c .ID )
447449 if err != nil {
0 commit comments