Revert change which uncollapsed Result objects
This commit is contained in:
1 parent
fd1fa723d5
commit
abd6a42455
3 files changed
+10
-37
No files matched your search
+5
-33
@@ -119,36 +119,6 @@ def getMachineStatus(username=None):
|
||||
"{0} Threads / ".format(sum([f.info['concurrency'] for f in machines])) + \
|
||||
"{0} MNPS ".format(round(sum([f.info['concurrency'] * f.mnps for f in machines]), 2))
|
||||
|
||||
def get_test_context(test):
|
||||
|
||||
# Select the Test, and all Result objects attached
|
||||
results = Result.objects.filter(test=test).order_by('machine_id')
|
||||
data = { 'test' : test, 'results': {} }
|
||||
|
||||
for result in results:
|
||||
|
||||
# Insert the Result into the results
|
||||
if result.machine.id not in data['results'].keys():
|
||||
data['results'][result.machine.id] = {
|
||||
'games' : 0, 'wins' : 0, 'losses' : 0,
|
||||
'draws' : 0, 'timeloss' : 0, 'crashes' : 0,
|
||||
}
|
||||
|
||||
# Always use the latest Time stamp, by virtue of sorting Results
|
||||
data['results'][result.machine.id]['machine_id'] = result.machine.id
|
||||
data['results'][result.machine.id]['username' ] = result.machine.user.username
|
||||
data['results'][result.machine.id]['updated' ] = result.updated
|
||||
|
||||
# Sum up all results from a given machine into a single value
|
||||
data['results'][result.machine.id]['games' ] += result.games
|
||||
data['results'][result.machine.id]['wins' ] += result.wins
|
||||
data['results'][result.machine.id]['losses' ] += result.losses
|
||||
data['results'][result.machine.id]['draws' ] += result.draws
|
||||
data['results'][result.machine.id]['timeloss' ] += result.timeloss
|
||||
data['results'][result.machine.id]['crashes' ] += result.crashes
|
||||
|
||||
return data
|
||||
|
||||
def getPaging(content, page, url, pagelen=25):
|
||||
|
||||
start = max(0, pagelen * (page - 1))
|
||||
@@ -547,9 +517,11 @@ def get_workload(machine):
|
||||
if not (tests := get_valid_workloads(machine)):
|
||||
return {}
|
||||
|
||||
# Select from valid workloads and create a Result object
|
||||
test = select_workload(machine, tests)
|
||||
result = Result(test=test, machine=machine)
|
||||
# Select from valid workloads the most needing test
|
||||
test = select_workload(machine, tests)
|
||||
|
||||
try: result = Result.objects.get(test=test, machine=machine)
|
||||
except: result = Result(test=test, machine=machine)
|
||||
|
||||
# Update the Machine's status and save everything
|
||||
machine.workload = test.id; machine.save(); result.save()
|
||||
|
||||
+2
-1
@@ -365,7 +365,8 @@ def test(request, id, action=None):
|
||||
return django.http.HttpResponseRedirect('/index/')
|
||||
|
||||
if action not in ['APPROVE', 'RESTART', 'STOP', 'DELETE', 'MODIFY']:
|
||||
return render(request, 'test.html', OpenBench.utils.get_test_context(test))
|
||||
data = { 'test' : test, 'results': Result.objects.filter(test=test) }
|
||||
return render(request, 'test.html', data)
|
||||
|
||||
if not request.user.is_authenticated:
|
||||
return redirect(request, '/login/', error='Only users may interact with tests')
|
||||
|
||||
@@ -173,10 +173,10 @@
|
||||
<th style="width: 60px">Crash</th>
|
||||
</tr>
|
||||
|
||||
{% for id, result in results.items %}
|
||||
{% for result in results %}
|
||||
<tr>
|
||||
<td>{{result.machine_id}}</td>
|
||||
<td>{{result.username|capfirst}}</td>
|
||||
<td><a href="/machines/{{result.machine.id}}">{{result.machine.id}}</a></td>
|
||||
<td>{{result.machine.user.username|capfirst}}</td>
|
||||
<td class="timestamp">{{result.updated|date:'U'}}</td>
|
||||
<td class="numeric">{{result.games}}</td>
|
||||
<td class="numeric">{{result.wins}}</td>
|
||||
|
||||
Reference in new issue
Block a user