Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:czlee/tabbycat into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
philipbelesky committed Aug 12, 2015
2 parents 6b68df0 + 5500223 commit f6aef8b
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 67 deletions.
6 changes: 3 additions & 3 deletions data/demo/speakers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Robin Roberson,Columbia University,1,1,M,he,1
Gwen Newman,Cornell University,1,1,F,she,1
Robyn Caldwell,Cornell University,1,1,F,,0
Angie Holt,Cornell University,1,1,F,she,1
Melvin Jordan,Harvard University,1,1,M,he,0
Gladys Burke,Harvard University,1,1,F,,0
Patty Saunders,Harvard University,1,1,M,he,1
Melvin Jordan,Harvard University,1,,M,he,
Gladys Burke,Harvard University,1,,F,,
Patty Saunders,Harvard University,1,,M,he,
Thomas Pierce,Harvard University,2,1,M,he,1
Stella Lindsey,Harvard University,2,1,F,she,1
Adrian May,Harvard University,2,1,M,he,1
Expand Down
13 changes: 13 additions & 0 deletions data/dummy/rounds.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
seq,name,abbv,stage,type,is_silent,feedback_weight,break_category
1,Round 1,R1,P,R,0,0.7,
2,Round 2,R2,P,P,0,0.7,
3,Round 3,R3,P,P,0,0.7,
4,Round 4,R4,P,P,0,0.7,
5,Open Quarterfinal,OQF,E,F,1,0.7,open
6,Open Semifinal,OSF,E,B,1,0.7,open
7,Open Grand Final,OGF,E,B,1,0.7,open
8,ESL Semifinal,SSF,E,F,1,0.7,esl
9,ESL Grand Final,SGF,E,B,1,0.7,esl
10,EFL Grand Final,FGF,E,F,1,0.7,efl
11,Novice Semifinal,NSF,E,F,1,0.7,novice
12,Novice Grand Final,NGF,E,B,1,0.7,novice
10 changes: 5 additions & 5 deletions debate/importer/anorak.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _round_line_parser(line):
'draw_type' : self._lookup(self.ROUND_DRAW_TYPES, line[4] or "r", "draw type"),
'silent' : bool(int(line[5])),
'feedback_weight' : float(line[6]) or 0.7,
'break_category' : m.BreakCategory.objects.get(slug=line[7]) if len(line) > 7 and line[7] else None,
'break_category' : m.BreakCategory.objects.get(slug=line[7], tournament=self.tournament) if len(line) > 7 and line[7] else None,
}
counts, errors = self._import(f, _round_line_parser, m.Round)

Expand Down Expand Up @@ -156,7 +156,7 @@ def _venue_line_parser(line):
'name' : line[0],
'priority' : int(line[1]) if len(line) > 1 else 10,
'group' : m.VenueGroup.objects.get(name=line[2]) if len(line) > 2 and line[2] else None,
'time' : line[3] if len(line) > 3 else None,
'time' : line[3] if len(line) > 3 and line[3] else None,
}
counts, errors = self._import(f, _venue_line_parser, m.Venue, counts=counts, errors=errors)

Expand Down Expand Up @@ -193,7 +193,7 @@ def _team_line_parser(line):
'institution' : m.Institution.objects.lookup(line[1]),
'reference' : line[0],
'short_reference' : line[0][:34],
'use_institution_prefix' : int(line[2]) if len(line) > 2 else 0,
'use_institution_prefix' : int(line[2]) if len(line) > 2 and line[2] else 0,
'emoji_seq' : self.get_emoji,
}
counts, errors = self._import(f, _team_line_parser, m.Team, generated_fields=['emoji_seq'])
Expand Down Expand Up @@ -223,7 +223,7 @@ def _team_line_parser(line):
'institution' : m.Institution.objects.lookup(line[1]),
'reference' : line[2],
'short_reference' : line[2][:35],
'use_institution_prefix' : int(line[3]) if len(line) > 3 else 0,
'use_institution_prefix' : int(line[3]) if len(line) > 3 and line[3] else 0,
'emoji_seq' : self.get_emoji,
}
counts, errors = self._import(f, _team_line_parser, m.Team, expect_unique=False, generated_fields=['emoji_seq'])
Expand All @@ -239,7 +239,7 @@ def _speaker_line_parser(line):
reference=line[2], tournament=self.tournament),
'gender' : self._lookup(self.GENDERS, line[4], "gender") if len(line) > 4 and line[4] else None,
'pronoun': str(line[5]) if len(line) > 5 and line[5] else None,
'novice' : int(line[6]) if len(line) > 6 and line[6] else None,
'novice' : int(line[6]) if len(line) > 6 and line[6] else False,
}
counts, errors = self._import(f, _speaker_line_parser, m.Speaker, counts=counts, errors=errors)

Expand Down
23 changes: 3 additions & 20 deletions debate/management/commands/clear_cache.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
from django.core.management.base import BaseCommand, CommandError
from django.core.urlresolvers import reverse
from django.utils.cache import get_cache_key
from django.core.cache import cache
from django.test import RequestFactory
from django.contrib.auth.models import AnonymousUser

class Command(BaseCommand):

def add_arguments(self, parser):
parser.add_argument("path")
help = "Clears django's cache"

def handle(self, *args, **options):
path = options['path']
factory = RequestFactory()
request = factory.get(path)
request.user = AnonymousUser()
key = get_cache_key(request, key_prefix=None)
if not key:
self.stdout.write("Could not find key for " + str(path) + "\n")
return
if not cache.get(key):
self.stdout.write("Could not find key " + str(key) + "\n")
return
if key and cache.get(key):
cache.delete(key)
self.stdout.write("Deleted cache for key " + str(key) + "\n")
cache.clear()
self.stdout.write("Cache has been cleared")
12 changes: 7 additions & 5 deletions templates/draw_display_by_team.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@
{% if show_emoji > 0 %}
<td class="team-emoji">{% team_emoji debate.aff_team %}</td>
{% endif %}
<td class="venue-name">
{% if debate.division %}
{{ debate.division.venue_group.short_name }}
{% if enable_venue_groups %}
{% if debate.division %}
<td class="venue-name">{{ debate.division.venue_group.short_name }}</td>
{% else %}
<td class="venue-name">{{ debate.venue.group.short_name }} {{ debate.venue.name }}</td>
{% endif %}
{% else %}
{{ debate.venue.group.short_name }}
<td class="venue-name">{{ debate.venue.name }}</td>
{% endif %}
</td>
{% if enable_venue_times %}
<td>
{% if debate.venue.time %}
Expand Down
4 changes: 2 additions & 2 deletions templates/draw_display_by_venue.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
{% endif %}
{% if enable_venue_groups %}
{% if debate.division %}
<td>{{ debate.division.venue_group.short_name }}</td>
<td class="venue-name">{{ debate.division.venue_group.short_name }}</td>
{% else %}
<td>{{ debate.venue.group.short_name }}</td>
<td class="venue-name">{{ debate.venue.group.short_name }} {{ debate.venue.name }}</td>
{% endif %}
{% else %}
<td class="venue-name">{{ debate.venue.name }}</td>
Expand Down
4 changes: 0 additions & 4 deletions templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<div id="footer" class="clearfix">
<nav class="navbar navbar-default {% if '/admin/' in request.path %}navbar-inverse{% endif %}" role="navigation">
<div class="container-fluid">
{% cache 600 footerleft request.tournament %}
<p class="navbar-brand text-muted"><small>
{% if tournament and enable_divisions == 0 %}
{% if tournament %}{{ tournament }} runs on {% endif %}
Expand All @@ -17,8 +16,6 @@
<a href="http://timekept.com" target="_new">Timekept</a> (iOS).
{% endif %}
</small></p>
{% endcache %}
{% cache 600 footerright request.user request.tournament %}
<p class="navbar-brand text-muted pull-right {% if '/admin/' in request.path %}navbar-inverse{% endif %}">
<a href="/">Home</a> |
{% if user.is_authenticated %}
Expand All @@ -33,7 +30,6 @@
<a href="/accounts/login/" title="Log in">Log in</a>
{% endif %}
</p>
{% endcache %}
</div>
</nav>
</div>
60 changes: 37 additions & 23 deletions templates/js/draw_adjs_edit_allocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,31 @@ function append_adj_scores() {
}).tooltip();
});
}
;

// CONFLICT BEHAVIOURS

// Read the dicitionary and check if the adj has any conflicts
function eachConflictingTeam(adj_id, fn) {
$.each(all_adj_conflicts['personal'][adj_id], function (i, n) {
$("#team_" + n).each( function() { fn('personal', this); });
});
$.each(all_adj_conflicts['history'][adj_id], function (i, n) {
$("#team_" + n).each( function() { fn('history', this); });
});
$.each(all_adj_conflicts['institutional'][adj_id], function (i, n) {
$("#team_" + n).each( function() { fn('institutional', this); });
});
$.each(all_adj_conflicts['adjudicator'][adj_id], function (i, n) {
$("#adj_" + n).each( function() { fn('adjudicator', this); });
});
if (all_adj_conflicts['personal'][adj_id].length > 0) {
$.each(all_adj_conflicts['personal'][adj_id], function (i, n) {
$("#team_" + n).each( function() { fn('personal', this); });
});
}
if (all_adj_conflicts['history'][adj_id].length > 0) {
$.each(all_adj_conflicts['history'][adj_id], function (i, n) {
$("#team_" + n).each( function() { fn('history', this); });
});
}
if (all_adj_conflicts['institutional'][adj_id].length > 0) {
$.each(all_adj_conflicts['institutional'][adj_id], function (i, n) {
$("#team_" + n).each( function() { fn('institutional', this); });
});
}
if (all_adj_conflicts['adjudicator'][adj_id].length > 0) {
$.each(all_adj_conflicts['adjudicator'][adj_id], function (i, n) {
$("#adj_" + n).each( function() { fn('adjudicator', this); });
});
}
}

function display_conflicts(target) {
Expand Down Expand Up @@ -198,15 +205,13 @@ function updateConflicts(debate_tr) {

// Check for incomplete panels
if ($(".panel-holder .adj", debate_tr).length % 2 != 0) {
console.log('incomplete');
$(".panel-holder", debate_tr).addClass("panel-incomplete");
} else {
$(".panel-holder", debate_tr).removeClass("panel-incomplete");
}

// Check for missing chairs
if ($(".chair-holder .adj", debate_tr).length != 1) {
console.log('no chair');
$(".chair-holder", debate_tr).addClass("chair-incomplete");
} else {
$(".chair-holder", debate_tr).removeClass("chair-incomplete");
Expand All @@ -217,7 +222,6 @@ function updateConflicts(debate_tr) {
// TABLE BEHAVIOURS

$('#allocationsTable .importance select').on('change', function() {
console.log("change");
var importance = $("option:selected", this).val(); // or $(this).val()
var cell = $(this).parent()
var row = $(this).parent().parent();
Expand Down Expand Up @@ -347,17 +351,29 @@ $("#allocationsTable .adj-holder").droppable( {
var oldHolder = adj[0].oldHolder; // Where the element came from
var destinationAdjs = $(".adj", this); // Any adjs present in the drop destination

// Adding the new judge to the new position

if ($(this).hasClass("chair-holder")) {
// Swap the two around if dropping into a single position
// Swap the two around if dropping into a chair (single) position
oldHolder.append(destinationAdjs);
$(this).append(adj);
rebindHoverEvents($(adj));
} else if ($(this).hasClass("adj-holder")) {
// If placing from any other position within the draw table just append
$(this).append(adj);
rebindHoverEvents($(adj));
}

if (!oldHolder.hasClass("adj-holder")) {
// If placing from the unused column
// If placing from the unused column remove the old (now empty) row
removeUnusedRow(oldHolder);
// If duplicate adjs is on we make a duplicate and append to unused
{% if duplicate_adjs %}
var adj_copy = adj.clone()
moveToUnused(adj_copy);
init_adj($(adj_copy)); // Need to enable all events
{% endif %}
}

$(this).append(adj);
rebindHoverEvents($(adj));
}
});

Expand Down Expand Up @@ -420,8 +436,6 @@ function moveToUnused(adj) {
// If the adj isn't already in the table
var new_row = unusedAdjTable.row.add( ["",formatScore(all_adj_scores[moving_adj_id])] ).draw(); // Adds a new row
var first_cell = $("td:first", new_row.node()).append(adj); // Append the adj element
} else {
// Adj is already in the table (probably just be dragging back)
}

}
Expand Down
6 changes: 3 additions & 3 deletions templates/js/draw_adjs_edit_flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
$('#toggle_unused_layout').click(function() {
if ($('#scratch').hasClass("fixed-right")) {
$('#scratch').removeClass("fixed-right").addClass("fixed-bottom");
$('#main').removeClass("col-xs-10").addClass("col-xs-2");
$('#main').removeClass("col-xs-10").addClass("col-xs-12");
} else {
$('#scratch').removeClass("fixed-bottom").addClass("fixed-right");
$('#main').addClass("col-xs-10").removeClass("col-xs-2");
$('#main').addClass("col-xs-10").removeClass("col-xs-12");
}
return false
});
Expand Down Expand Up @@ -49,7 +49,7 @@ $('#toggle_breakcategory').click(function() {
});

$('#toggle_venues').click(function() {
var venuesColumn = allocationsTable.column(2);
var venuesColumn = allocationsTable.column(3);
venuesColumn.visible( ! venuesColumn.visible() );
$("span", this).toggleClass("glyphicon-eye-open").toggleClass("glyphicon-eye-close");
return false
Expand Down
8 changes: 6 additions & 2 deletions templates/print/print_score_ballot.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
<span class="h3 pull-left no-vertical-spacing">
{{ source.name }}'s {% if source_type == "chair" %}Ⓒ{% elif source_type == "trainee" %}Ⓣ{% endif %} Ballot
</span>
<span class="badge h3 no-vertical-spacing pull-right">{{ round.name }}</span>
<span class="badge h3 no-vertical-spacing pull-right">Room {{ debate.venue.name }}</span>
<span class="badge h3 no-vertical-spacing pull-right">
{{ round.name }}
</span>
<span class="badge h3 no-vertical-spacing pull-right">
{% if debate.venue.group %}{{ debate.venue.group.short_name }} {% endif %}{{ debate.venue.name }}
</span>
</div>
<p class="small text-muted">

Expand Down

0 comments on commit f6aef8b

Please sign in to comment.