diff options
| author | Jeff Carr <[email protected]> | 2025-03-10 17:24:06 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-10 17:24:06 -0500 |
| commit | 3870959747c13246441a0e4e79503e030176736b (patch) | |
| tree | 55d73251e482a85218b9eb5a488d28eb5cf33026 | |
| parent | 1b145d1f04e4cd0e83f1c603af13803f0027fabb (diff) | |
fix patches statsv0.22.105
| -rw-r--r-- | windowPatches.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/windowPatches.go b/windowPatches.go index 5735872..95c3b74 100644 --- a/windowPatches.go +++ b/windowPatches.go @@ -4,6 +4,7 @@ package main import ( + "fmt" "sync" "go.wit.com/gui" @@ -30,7 +31,7 @@ func (w *stdPatchTableWin) Toggle() { w.win.Toggle() } -func makePatchesWin(p *forgepb.Patches) *stdPatchTableWin { +func makePatchesWin(patches *forgepb.Patches) *stdPatchTableWin { dwin := new(stdPatchTableWin) dwin.win = gadgets.NewGenericWindow("current patches", "patching options") dwin.win.Custom = func() { @@ -39,16 +40,18 @@ func makePatchesWin(p *forgepb.Patches) *stdPatchTableWin { } grid := dwin.win.Group.RawGrid() - grid.NewLabel(fmt.Sprintf("%d", p.Len()) - grid.NewLabel(fmt.Sprintf("total patches") + grid.NewLabel(fmt.Sprintf("%d", patches.Len())) + grid.NewLabel(fmt.Sprintf("total patches")) grid.NextRow() - all := p.All() + repomap := make(map[string]int) + all := patches.All() for all.Scan() { - repo := all.Next() + patch := all.Next() + repomap[patch.RepoNamespace] += 1 } - grid.NewLabel(fmt.Sprintf("%d", p.Len()) - grid.NewLabel(fmt.Sprintf("total repos") + grid.NewLabel(fmt.Sprintf("%d", len(repomap))) + grid.NewLabel(fmt.Sprintf("total repos")) grid.NextRow() grid.NewButton("reload", func() { @@ -57,8 +60,8 @@ func makePatchesWin(p *forgepb.Patches) *stdPatchTableWin { // make a box at the bottom of the window for the protobuf table dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX") - if p != nil { - dwin.doPatchesTable(p) + if patches != nil { + dwin.doPatchesTable(patches) } return dwin |
