From f8e344fe00c86cdc96e526ac61eda3dcf6035bd5 Mon Sep 17 00:00:00 2001 From: AndyGrant Date: Sun, 10 Jun 2018 03:09:57 -0400 Subject: [PATCH] Cleanup stat blocks --- OpenBench/templatetags/mytags.py | 17 ++++++++++++++++ OpenBench/views.py | 12 ++++++++++- Templates/OpenBench/index.html | 34 ++++++++++--------------------- db.sqlite3 | Bin 56320 -> 56320 bytes 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/OpenBench/templatetags/mytags.py b/OpenBench/templatetags/mytags.py index 55ed3f7..ab01e26 100644 --- a/OpenBench/templatetags/mytags.py +++ b/OpenBench/templatetags/mytags.py @@ -42,8 +42,25 @@ def gitDiffLink(test): return "{0}/compare/{1}...{2}".format(repo, basesha[:8], devsha[:8]) +def statParagraph(test): + + tokens = test.devoptions.split(" ") + threads = tokens[0].split("=")[1] + hash = tokens[1].split("=")[1] + + lowerllr = twoDigitPrecision(test.lowerllr) + currentllr = twoDigitPrecision(test.currentllr) + upperllr = twoDigitPrecision(test.upperllr) + elolower = twoDigitPrecision(test.elolower) + eloupper = twoDigitPrecision(test.eloupper) + + return "SPRT @ {0}s Threads={1} Hash={2}MB
".format(test.timecontrol, threads, hash) \ + + "LLR: {0} ({1}, {2}) [{3}, {4}]
".format(lowerllr, currentllr, upperllr, elolower, eloupper) \ + + "Games: {0} W: {1} L: {2} D: {3}".format(test.games, test.wins, test.losses, test.draws) + register = template.Library() register.filter("oneDigitPrecision", oneDigitPrecision) register.filter("twoDigitPrecision", twoDigitPrecision) register.filter("gitDiffLink", gitDiffLink) +register.filter("statParagraph", statParagraph) diff --git a/OpenBench/views.py b/OpenBench/views.py index 228e2c3..d07bceb 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -163,7 +163,17 @@ def editTest(request, id): pass def viewTest(request, id): - pass + + try: + # Find Test and Results + test = Test.objects.get(id=id) + results = Results.objects.all().filter(test=test) + data = {'test' : test, 'results' : results} + return render(request, 'viewTest.html', data) + + # Unable to find test + except Exception as error: + return index(request, error=str(error)) @staff_member_required def approveTest(request, id): diff --git a/Templates/OpenBench/index.html b/Templates/OpenBench/index.html index 04b8f55..e6560e1 100644 --- a/Templates/OpenBench/index.html +++ b/Templates/OpenBench/index.html @@ -11,17 +11,13 @@ Index {% for test in pending %} - + - + {% autoescape off %} + + {% endautoescape %} {% endfor %} @@ -30,17 +26,13 @@ Index

Active

{{test.author}} {{test.dev.name}} diff - SPRT @ {{test.timecontrol}}s Threads={{test.threads}} Hash={{test.hashsize}}MB
- LLR: {{test.currentllr|twoDigitPrecision}} ({{test.lowerllr|twoDigitPrecision}}, - {{test.upperllr|twoDigitPrecision}}) [{{test.elolower|twoDigitPrecision}}, - {{test.eloupper|twoDigitPrecision}}]
Games: {{test.games}} - W: {{test.wins}} L: {{test.losses}} D: {{test.draws}} -
{{test|statParagraph}}approve
{% for test in active %} - + - + {% autoescape off %} + + {% endautoescape %} {% endfor %}
{{test.author}} {{test.dev.name}} diff - SPRT @ {{test.timecontrol}}s Threads={{test.threads}} Hash={{test.hashsize}}MB
- LLR: {{test.currentllr|twoDigitPrecision}} ({{test.lowerllr|twoDigitPrecision}}, - {{test.upperllr|twoDigitPrecision}}) [{{test.elolower|twoDigitPrecision}}, - {{test.eloupper|twoDigitPrecision}}]
Games: {{test.games}} - W: {{test.wins}} L: {{test.losses}} D: {{test.draws}} -
{{test|statParagraph}}
@@ -52,13 +44,9 @@ Index - + {% autoescape off %} + + {% endautoescape %} {% endfor %}
{{test.author}} {{test.dev.name}} diff - SPRT @ {{test.timecontrol}}s Threads={{test.threads}} Hash={{test.hashsize}}MB
- LLR: {{test.currentllr|twoDigitPrecision}} ({{test.lowerllr|twoDigitPrecision}}, - {{test.upperllr|twoDigitPrecision}}) [{{test.elolower|twoDigitPrecision}}, - {{test.eloupper|twoDigitPrecision}}]
Games: {{test.games}} - W: {{test.wins}} L: {{test.losses}} D: {{test.draws}} -
{{test|statParagraph}}
diff --git a/db.sqlite3 b/db.sqlite3 index b7996c6193e740cbefae8441fe7c1a015ab3001a..48391c7e8ec76ca01c95ddae3084df41831d46f7 100644 GIT binary patch delta 290 zcmZqJ!Q8Ned4e>f=R_H2M$e52ceq4Zg!q{?8T|`V^PE!ik~88+4caVQ_C z-oQZ5z{JGV%mPC_TxPS+;T-~8%*-DcnEx<;WB#yNP~j1?94j*;BQrCYWMXFKf+e8^>Mz@U#ceq5Eh4`5@8T|`V^PE!ik~88#L~#X&_dV1OxMsr!NAPQ1W9JI&*2>c98ApL7?}Sse*+r*ih1&f>#TxI j%*>peTnr2hOw3;yn13^W1xmdHNwKgqF|jZ+axwt`Ob|A^