From 9b1e75c0bca1d22b91dbbe645620ffdd7a245a68 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 1 Feb 2018 15:40:32 +0100 Subject: dashboard/app: fix patched/missing on numbers We currently print N/M which does not mean N out of M are patched, instead it means N patched and M are not patched. This is confusing. Print more traditional "N out of M". --- dashboard/app/main.go | 8 ++++++-- dashboard/app/templates.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dashboard/app/main.go b/dashboard/app/main.go index dfbeb18cb..e7cef081b 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -93,6 +93,7 @@ type uiBug struct { Commits string PatchedOn []string MissingOn []string + NumManagers int } type uiCrash struct { @@ -389,7 +390,7 @@ func createUIBug(c context.Context, bug *Bug, state *ReportingState, managers [] Status: status, Link: bugLink(id), ExternalLink: link, - PatchedOn: bug.PatchedOn, + NumManagers: len(managers), } if len(bug.Commits) != 0 { uiBug.Commits = fmt.Sprintf("%q", bug.Commits) @@ -401,10 +402,13 @@ func createUIBug(c context.Context, bug *Bug, state *ReportingState, managers [] break } } - if !found { + if found { + uiBug.PatchedOn = append(uiBug.PatchedOn, mgr) + } else { uiBug.MissingOn = append(uiBug.MissingOn, mgr) } } + sort.Strings(uiBug.PatchedOn) sort.Strings(uiBug.MissingOn) } return uiBug diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html index b026a9970..90c0c1555 100644 --- a/dashboard/app/templates.html +++ b/dashboard/app/templates.html @@ -25,7 +25,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{$b.NumCrashes}} {{formatReproLevel $b.ReproLevel}} {{formatLateness $.Now $b.LastTime}} - {{if $b.Commits}}{{len $b.PatchedOn}}/{{len $b.MissingOn}}{{end}} + {{if $b.Commits}}{{len $b.PatchedOn}}/{{$b.NumManagers}}{{end}} {{if $b.ExternalLink}}{{$b.Status}}{{else}}{{$b.Status}}{{end}} {{end}} -- cgit mrf-deployment