Approve tests

This commit is contained in:
AndyGrant committed 2018-06-10 02:34:41 -04:00
1 parent e8025ecb98
commit 478b743b92
9 files changed
+41 -19

No files matched your search

+2
View File
@@ -61,6 +61,8 @@ class Results(Model):
class Test(Model):
author = CharField(max_length=64)
dev = ForeignKey('Engine', PROTECT, related_name='dev')
base = ForeignKey('Engine', PROTECT, related_name='base')
+3 -7
View File
@@ -1,5 +1,5 @@
body {
font-family: "Courier New";
font-family: "Consolas";
font-size: 20px;
}
@@ -32,19 +32,15 @@ table {
font-size: 20px;
}
th, td {
border: 1px solid black;
}
th {
text-align: center;
padding: 3px 16px;
padding: 4px 16px;
background-color: #4CAF50;
color: white;
}
td {
padding: 2px 16px;
padding: 4px 16px;
text-align: right;
}
+1
View File
@@ -34,6 +34,7 @@ def newEngine(name, source, protocol, sha, bench):
def newTest(request):
test = Test() # New Test, saved only after parsing
test.author = request.user.username
# Extract Development Fields
devname = request.POST['devbranch']
+19 -2
View File
@@ -133,7 +133,14 @@ def newTest(request):
try:
# Create test and verify fields
OpenBench.utils.newTest(request)
test = OpenBench.utils.newTest(request)
# Log the test creation
event = LogEvent()
event.data = '{0} : Created {1} (id={2})'.format(
request.user.username, str(test), test.id)
event.save()
return HttpResponseRedirect('/index/')
# Bad data, kick back to index with error
@@ -149,7 +156,17 @@ def viewTest(request, id):
@staff_member_required
def approveTest(request, id):
pass
try:
# Approve the provided test
test = Test.objects.get(id=id)
test.approved = True
test.save()
return HttpResponseRedirect('/index/')
# Bad test id, permissions, or other
except Exception as error:
return index(request, error=str(error))
def getFiles(request):
pass