diff --git a/templates/hardware/view.tmpl b/templates/hardware/view.tmpl index 7c6f857..5baa876 100644 --- a/templates/hardware/view.tmpl +++ b/templates/hardware/view.tmpl @@ -7,9 +7,30 @@
-

Latest Benchmark Results:

+

Tests Using This Component:

-

There are currently no benchmarks recorded using this hardware component.

+ {{ $length := len .hardware.Tests }} {{ if eq $length 0 }} +

There are currently no tests using this hardware component.

+ {{ else }} + + + + + + + + + + {{ range $test := .hardware.Tests }} + + + + + + {{ end }} + +
Test# of BenchmarksLast Updated
{{ $test.Name }}{{ len $test.Benchmarks }}{{ $test.CreatedAt.Format "01/02/2006 15:04am" }}
+ {{ end }}
diff --git a/web/routes/hardware.go b/web/routes/hardware.go index 784ac94..4bc2072 100644 --- a/web/routes/hardware.go +++ b/web/routes/hardware.go @@ -30,7 +30,7 @@ func HardwareGetView(c flamego.Context, t template.Template, data template.Data) // find hardware from DB var hardware models.Hardware - models.DB.First(&hardware, hardwareID) + models.DB.Preload("Tests.Benchmarks").First(&hardware, hardwareID) data["hardware"] = hardware data["title"] = hardware.Name