From 032e78d99d6e29e8026707dc63f26140adce266b Mon Sep 17 00:00:00 2001 From: Peter Bourgon Date: Mon, 15 Jun 2015 11:20:30 +0200 Subject: [PATCH] Dedupe tables in detail pane --- report/detailed_node.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/report/detailed_node.go b/report/detailed_node.go index f7ca2fe36..a7ecda388 100644 --- a/report/detailed_node.go +++ b/report/detailed_node.go @@ -1,6 +1,9 @@ package report -import "strconv" +import ( + "reflect" + "strconv" +) // MakeDetailedNode transforms a renderable node to a detailed node. It uses // aggregate metadata, plus the set of origin node IDs, to produce tables. @@ -26,10 +29,15 @@ func MakeDetailedNode(r Report, n RenderableNode) DetailedNode { // multiple origins. The ultimate goal here is to generate tables to view // in the UI, so we skip the intermediate representations, but we could // add them later. +outer: for _, id := range n.Origins { if table, ok := OriginTable(r, id); ok { - // Origin node IDs are unique, so we'll be optimistic, here, and - // assume they'll also produce unique tables. + // TODO there's a bug that yields duplicate tables. Quick fix. + for _, existing := range tables { + if reflect.DeepEqual(existing, table) { + continue outer + } + } tables = append(tables, table) } }