Skip to content

Commit

Permalink
add new votes for secondary criteria judgin hackupc 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchyy committed Oct 13, 2019
1 parent db6bc3e commit f1fd1a7
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 9 deletions.
16 changes: 16 additions & 0 deletions applications/migrations/0026_merge_20191013_0204.py
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-10-13 00:04
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('applications', '0025_auto_20191010_1815'),
('applications', '0025_auto_20191010_0029'),
]

operations = [
]
1 change: 1 addition & 0 deletions hardware
Submodule hardware added at e5f68b
11 changes: 10 additions & 1 deletion judging/admin.py
Expand Up @@ -22,7 +22,7 @@ class RoomAdmin(admin.ModelAdmin):

class PresentationAdmin(admin.ModelAdmin):
list_display = ('project', 'room', 'done', 'score', 'tech_score',
'learning_score')
'learning_score', 'design_score', 'ux_score', 'smoke_score')
list_filter = ('room__challenge', 'room', 'done')

def score(self, presentation):
Expand All @@ -33,6 +33,15 @@ def score(self, presentation):
def tech_score(self, presentation):
return presentation.tech_avg

def design_score(self, presentation):
return presentation.design_avg

def ux_score(self, presentation):
return presentation.ux_avg

def smoke_score(self, presentation):
return presentation.smoke_avg

tech_score.admin_order_field = 'tech_score'

def design_score(self, presentation):
Expand Down
14 changes: 9 additions & 5 deletions judging/models.py
Expand Up @@ -2,8 +2,7 @@
from django.db.models import Count, Q, Avg, F

from app import settings
from user.models import User

from user.models import User

class Challenge(models.Model):
name = models.CharField(max_length=25)
Expand Down Expand Up @@ -122,6 +121,11 @@ def annotate_score(cls, qs):
(5, '5')
)

SECONDARY_CRITERIA = (
(0, '0'),
(1, '1')
)


class PresentationEvaluation(models.Model):
presentation = models.ForeignKey(Presentation, on_delete=models.CASCADE)
Expand All @@ -131,9 +135,9 @@ class PresentationEvaluation(models.Model):
learning = models.IntegerField(choices=VOTES)
idea = models.IntegerField(choices=VOTES)
# Auxiliar criteria
design = models.IntegerField(choices=VOTES)
ux = models.IntegerField(choices=VOTES)
smoke = models.IntegerField(choices=VOTES)
design = models.IntegerField(choices=SECONDARY_CRITERIA)
ux = models.IntegerField(choices=SECONDARY_CRITERIA)
smoke = models.IntegerField(choices=SECONDARY_CRITERIA)

class Meta:
unique_together = (('presentation', 'judge_alias'))
6 changes: 6 additions & 0 deletions judging/templates/include/number2.html
@@ -0,0 +1,6 @@
<div class="">
<select name="{{ name }}" class="barrating " required>
<option value="0" selected>1</option>
<option value="1">2</option>
</select>
</div>
6 changes: 3 additions & 3 deletions judging/templates/room_judging.html
Expand Up @@ -67,9 +67,9 @@ <h4 class="text-center">Secondary Score</h4>
<dl class="dl-horizontal">
<div class="row">
<div class="col-md-2"><dt>Judge {{ judge }}</dt><dd></dd></div>
<div class="col-md-2 col-md-offset-2">{% include 'include/number5.html' with name="design_score_"|add:judge %}</div>
<div class="col-md-2">{% include 'include/number5.html' with name="ux_score_"|add:judge %}</div>
<div class="col-md-2">{% include 'include/number5.html' with name="smoke_score_"|add:judge %}</div>
<div class="col-md-2 col-md-offset-2">{% include 'include/number2.html' with name="design_score_"|add:judge %}</div>
<div class="col-md-2">{% include 'include/number2.html' with name="ux_score_"|add:judge %}</div>
<div class="col-md-2">{% include 'include/number2.html' with name="smoke_score_"|add:judge %}</div>
</div>
</dl>
{% endfor %}
Expand Down

0 comments on commit f1fd1a7

Please sign in to comment.