Cleanup stat blocks

This commit is contained in:
AndyGrant committed 2018-06-10 03:09:57 -04:00
1 parent 7abc4ab567
commit f8e344fe00
4 files changed
+39 -24

No files matched your search

+17
View File
@@ -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<br>".format(test.timecontrol, threads, hash) \
+ "LLR: {0} ({1}, {2}) [{3}, {4}]<br>".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)
+11 -1
View File
@@ -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):
+11 -23
View File
@@ -11,17 +11,13 @@ Index
<table>
<tr>
{% for test in pending %}
<tr class="{{test.status}}">
<tr>
<td><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
<td style="text-align:left"><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td style="text-align"><a href="{{test|gitDiffLink}}">diff</a></td>
<td style="text-align:left;font-size:14px"><strong>
SPRT @ {{test.timecontrol}}s Threads={{test.threads}} Hash={{test.hashsize}}MB<br>
LLR: {{test.currentllr|twoDigitPrecision}} ({{test.lowerllr|twoDigitPrecision}},
{{test.upperllr|twoDigitPrecision}}) [{{test.elolower|twoDigitPrecision}},
{{test.eloupper|twoDigitPrecision}}] <br> Games: {{test.games}}
W: {{test.wins}} L: {{test.losses}} D: {{test.draws}}
</strong></td>
{% autoescape off %}
<td style="text-align:left;font-size:14px"><strong>{{test|statParagraph}}</strong></td>
{% endautoescape %}
<td><a href="/approveTest/{{test.id}}">approve</td>
</tr>
{% endfor %}
@@ -30,17 +26,13 @@ Index
<h2>Active</h2>
<table>
{% for test in active %}
<tr class="{{test.status}}">
<tr>
<td><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
<td style="text-align:left"><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td style="text-align:left"><a href="{{test|gitDiffLink}}">diff</a></td>
<td style="text-align:left;font-size:14px"><strong>
SPRT @ {{test.timecontrol}}s Threads={{test.threads}} Hash={{test.hashsize}}MB<br>
LLR: {{test.currentllr|twoDigitPrecision}} ({{test.lowerllr|twoDigitPrecision}},
{{test.upperllr|twoDigitPrecision}}) [{{test.elolower|twoDigitPrecision}},
{{test.eloupper|twoDigitPrecision}}] <br> Games: {{test.games}}
W: {{test.wins}} L: {{test.losses}} D: {{test.draws}}
</strong></td>
{% autoescape off %}
<td style="text-align:left;font-size:14px"><strong>{{test|statParagraph}}</strong></td>
{% endautoescape %}
</tr>
{% endfor %}
<table>
@@ -52,13 +44,9 @@ Index
<td><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
<td style="text-align:left"><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td style="text-align:left"><a href="{{test|gitDiffLink}}">diff</a></td>
<td style="text-align:left;font-size:14px"><strong>
SPRT @ {{test.timecontrol}}s Threads={{test.threads}} Hash={{test.hashsize}}MB<br>
LLR: {{test.currentllr|twoDigitPrecision}} ({{test.lowerllr|twoDigitPrecision}},
{{test.upperllr|twoDigitPrecision}}) [{{test.elolower|twoDigitPrecision}},
{{test.eloupper|twoDigitPrecision}}] <br> Games: {{test.games}}
W: {{test.wins}} L: {{test.losses}} D: {{test.draws}}
</strong></td>
{% autoescape off %}
<td style="text-align:left;font-size:14px"><strong>{{test|statParagraph}}</strong></td>
{% endautoescape %}
</tr>
{% endfor %}
</table>
BIN
View File
Binary file not shown.