From 9df8f6c9e1faa82c269ba37158b624831a3e6e72 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Wed, 29 May 2024 11:25:45 -0400 Subject: [PATCH] Added result model; added form to submit results --- models/init.go | 2 +- models/result.go | 23 +++++++++++++++++++++++ templates/test/view.tmpl | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 models/result.go diff --git a/models/init.go b/models/init.go index d44512a..272f10a 100644 --- a/models/init.go +++ b/models/init.go @@ -21,6 +21,6 @@ func Open() { } // Migrate the schema - DB.AutoMigrate(&Test{}, &Hardware{}, &Benchmark{}) + DB.AutoMigrate(&Test{}, &Hardware{}, &Benchmark{}, &Result{}) log.Println("Database migrations complete.") } diff --git a/models/result.go b/models/result.go new file mode 100644 index 0000000..a22f1d1 --- /dev/null +++ b/models/result.go @@ -0,0 +1,23 @@ +package models + +import ( + "gorm.io/gorm" +) + +type Test struct { + gorm.Model + Name string + Description string + + // belongs to Hardware + HardwareID int + Hardware Hardware + + // belongs to Benchmark + BenchmarkID int + Benchmark Benchmark + + // belongs to Test + TestID int + Test Test +} diff --git a/templates/test/view.tmpl b/templates/test/view.tmpl index e4c3547..f543b0a 100644 --- a/templates/test/view.tmpl +++ b/templates/test/view.tmpl @@ -17,6 +17,41 @@
+

Add new result:

+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + +
+
+ +
+

Latest Benchmark Results:

There are currently no benchmarks recorded in this test.