Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
philipbelesky committed Aug 23, 2017
2 parents 12f36d4 + eb7d1e8 commit 4cff209
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 34 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
Change Log
==========

1.4.2
-----
*Release date: 23 August 2017*

- Minor bug fixes and error logging improvements


1.4.1
-----
*Release date: 2 August 2017*

- Fixed bug that prevented edited matchups from being saved
- Added flag to prevent retired sites from using the database for sessions


1.4.0 (Havana Brown)
--------------------
*Release date: 26 July 2017*
Expand All @@ -31,6 +39,7 @@ Change Log
- Fixed issue where VenueCategories could not be edited if they did not have Venues set
- Various other small fixes and improvements


1.3.1
-----
*Release date: 26 May 2017*
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# The short X.Y version.
version = '1.4'
# The full version, including alpha/beta/rc tags.
release = '1.4.1'
release = '1.4.2'

rst_epilog = """
.. |vrelease| replace:: v{release}
Expand Down
4 changes: 1 addition & 3 deletions tabbycat/adjallocation/hungarian.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def allocate(self):
"(less than %d)", len(panel_debates), len(panellists), len(panel_debates) * 3)

# Allocate solos

m = Munkres()

if len(solos) > 0:
Expand All @@ -131,8 +130,7 @@ def allocate(self):
alloc = []

# Allocate panellists

if len(panellists) > 0:
if len(panellists) > 0 and len(panel_debates) > 0:
logger.info("costing panellists")
cost_matrix = []
for i, debate in enumerate(panel_debates):
Expand Down
12 changes: 7 additions & 5 deletions tabbycat/draw/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib import admin
from django.core.exceptions import MultipleObjectsReturned
from django.db.models import Prefetch
from django.utils.translation import ugettext_lazy, ungettext

from adjallocation.models import DebateAdjudicator
from utils.admin import TabbycatModelAdminFieldsMixin
Expand Down Expand Up @@ -79,14 +80,15 @@ def get_neg_team(self, obj):
def _make_set_result_status(value, verbose_name):
def _set_result_status(modeladmin, request, queryset):
count = queryset.update(result_status=value)
message_bit = "1 debate had its" if count == 1 else "{:d} debates had their".format(
count)
modeladmin.message_user(
request, message_bit + " status set to " + verbose_name)
message = ungettext("%(count)d debate had its status set to %(status)s.",
"%(count)d debates had their statuses set to %(status)s.", count) % {
'count': count, 'status': verbose_name}
modeladmin.message_user(request, message)

# so that they look different to DebateAdmin
_set_result_status.__name__ = "set_result_status_%s" % verbose_name.lower()
_set_result_status.short_description = "Set result status to %s" % verbose_name.lower()
_set_result_status.short_description = ugettext_lazy("Set result status to "
"%(status)s") % {'status': verbose_name}
return _set_result_status

actions.append(_make_set_result_status(value, verbose_name))
Expand Down
8 changes: 4 additions & 4 deletions tabbycat/draw/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class Debate(models.Model):
STATUS_POSTPONED = 'P'
STATUS_DRAFT = 'D'
STATUS_CONFIRMED = 'C'
STATUS_CHOICES = ((STATUS_NONE, _("None")),
(STATUS_POSTPONED, _("Postponed")),
(STATUS_DRAFT, _("Draft")),
(STATUS_CONFIRMED, _("Confirmed")), )
STATUS_CHOICES = ((STATUS_NONE, _("none")),
(STATUS_POSTPONED, _("postponed")),
(STATUS_DRAFT, _("draft")),
(STATUS_CONFIRMED, _("confirmed")), )

objects = DebateManager()

Expand Down
2 changes: 1 addition & 1 deletion tabbycat/participants/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SpeakerAdmin(admin.ModelAdmin):

class SpeakerInline(admin.TabularInline):
model = Speaker
fields = ('name', 'novice', 'gender')
fields = ('name', 'gender')


class TeamSideAllocationInline(admin.TabularInline):
Expand Down
13 changes: 11 additions & 2 deletions tabbycat/printing/templates/PrintableScoresheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
<div class="db-align-vertical-center db-flex-item db-flex-static db-vertical-center-text">
Motion:
</div>
<div class="db-flex-item db-align-vertical-center">
<div class="db-flex-item db-align-vertical-center" v-if="motions">
<em>{{ motions[0].text }}</em>
</div>
<div v-else class="db-flex-item db-padding-horizontal db-fill-in"></div>
</div>
</section>

Expand All @@ -38,7 +39,8 @@
<div class="db-flex-item-1 "></div>
<div class="db-flex-item-2 db-flex-row">
<div class="db-item-gutter"></div>
<div v-for="motion in roundInfo.motions" class="db-align-horizontal-center db-align-vertical-start db-flex-item-1 db-center-text">
<div v-for="motion in motionsAccountingForBlanks"
class="db-align-horizontal-center db-align-vertical-start db-flex-item-1 db-center-text">
<span class="db-fill-in">{{ motion.seq }}</span>
</div>
<div class="db-item-gutter"></div>
Expand Down Expand Up @@ -110,6 +112,13 @@ export default {
} else {
return this.ballot.panel
}
},
motionsAccountingForBlanks: function() {
if (this.roundInfo.motions.length > 0) {
return this.roundInfo.motions
} else {
return [{'seq': 1}, {'seq': 2}, {'seq': 3}]
}
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions tabbycat/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
LANGUAGE_CODE = 'en'
USE_I18N = True

TABBYCAT_VERSION = '1.4.1'
TABBYCAT_VERSION = '1.4.2'
TABBYCAT_CODENAME = 'Havana Brown'
READTHEDOCS_VERSION = 'v1.4.1'
READTHEDOCS_VERSION = 'v1.4.2'

LOCALE_PATHS = [
os.path.join(BASE_DIR, 'locale'),
Expand Down Expand Up @@ -251,6 +251,9 @@
'release': TABBYCAT_VERSION,
}

# Custom implementation makes the user ID the e-mail address, rather than the primary key
SENTRY_CLIENT = 'utils.raven.TabbycatRavenClient'

# ==============================================================================
# Messages
# ==============================================================================
Expand Down
1 change: 1 addition & 0 deletions tabbycat/templates/js-vue/ajax/AjaxMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
success: function(data, textStatus, xhr) {
self.$eventHub.$emit('update-saved-counter', this.updateLastSaved)
console.log("AJAX: Saved " + message)
console.log('DEBUG: JSON ajaxSave success data:', data)
var dataResponse = JSON.parse(data)
if (completeFunction !== null) {
completeFunction(dataResponse, payload, returnPayload)
Expand Down
45 changes: 29 additions & 16 deletions tabbycat/templates/js-vue/ajax/TeamMovingMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,46 @@ export default {
},
saveMoveForType(teamId, fromDebate, toDebate, toPosition) {
var team = this.allTeamsById[teamId]
// Data Logic
if (toDebate === 'unused') {
var fromPosition = _.findKey(fromDebate.teams, team);
delete fromDebate.teams[fromPosition]
this.unallocatedItems.push(team) // Need to push; not append
// Update front end otherwise teams wont appear removed
this.$set(this.debatesById[fromDebate.id], 'teams', fromDebate.teams)
}
if (fromDebate === 'unused') {
if (toDebate.teams[toPosition]) { // If replacing a team
this.unallocatedItems.push(toDebate.teams[toPosition])
}
toDebate.teams[toPosition] = team
this.unallocatedItems.splice(this.unallocatedItems.indexOf(team), 1)
}
if (toDebate !== 'unused' && fromDebate !== 'unused') {
// Moving from one debate to another
var fromPosition = _.findKey(fromDebate.teams, team);
if (toDebate.teams[toPosition]) {
// If replacing a team
// Replacing a team
fromDebate.teams[fromPosition] = toDebate.teams[toPosition]
} else {
// If not replacing a team
delete fromDebate.teams[fromPosition]
// Update front end otherwise teams wont appear removed
this.$set(this.debatesById[fromDebate.id], 'teams', fromDebate.teams)
}
// Set the move and update the front end
toDebate.teams[toPosition] = team
this.$set(this.debatesById[toDebate.id], 'teams', toDebate.teams)
} else if (toDebate === 'unused') {
// Moving to the unused area
var fromPosition = _.findKey(fromDebate.teams, team);
delete fromDebate.teams[fromPosition]
this.unallocatedItems.push(team) // Need to push; not append
// Update front end otherwise teams wont appear removed
this.$set(this.debatesById[fromDebate.id], 'teams', fromDebate.teams)
} else if (fromDebate === 'unused') {
// Moving to a debate
if (toDebate.teams[toPosition]) {
// If replacing a team move them to unused
this.unallocatedItems.push(toDebate.teams[toPosition])
}
// Set the move and update the front end
toDebate.teams[toPosition] = team
this.$set(this.debatesById[toDebate.id], 'teams', toDebate.teams)
// Remove from unallocated
this.unallocatedItems.splice(this.unallocatedItems.indexOf(team), 1)
}
// Saving
var debatesToSave = this.determineDebatesToSave(fromDebate, toDebate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default {
var self = this
xhr.open('GET', apiURL)
xhr.onload = function () {
console.log('DEBUG: JSON TournamentOverview fetchData onload:', xhr.responseText)
if (resource === 'actions') {
self.latestActions = JSON.parse(xhr.responseText);
setTimeout(self.updateActions, self.pollFrequency);
Expand Down
1 change: 1 addition & 0 deletions tabbycat/templates/js-vue/draganddrops/DroppableMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default {
this.isDroppable = false;
if (typeof this.handleDrop === 'function') {
var payloadData = event.dataTransfer.getData("text");
console.log('DEBUG: JSON drop handleDrop payloadData', payloadData)
this.handleDrop(JSON.parse(payloadData));
}
},
Expand Down
44 changes: 44 additions & 0 deletions tabbycat/utils/raven.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from django.conf import settings
from raven.contrib.django.raven_compat import DjangoClient
from raven.contrib.django.utils import get_host


class TabbycatRavenClient(DjangoClient):
"""Customizations to the Raven client for Tabbycat.
The base implementation can be found at:
https://github.com/getsentry/raven-python/blob/master/raven/contrib/django/client.py
"""

def get_data_from_request(self, request):
"""Override the user ID with the e-mail address if it exists, or append
the host name if it does not exist. (Because we receive reports from
many sites, the primary key of the user isn't very helpful.)"""

result = super().get_data_from_request(request)

try:
user_info = result.get('user')
if user_info:
if user_info.get('email'):
# If there's an e-mail address, just use it.
user_info['id'] = user_info['email']
else:
# Otherwise, append the host name.
host = get_host(request)
user_info['id'] = "%s@%s" % (user_info['id'], host)
except Exception:
# Just make best efforts; if it all fell apart, so be it.
pass

return result

def build_msg(self, *args, **kwargs):
data = super().build_msg(*args, **kwargs)

# Add tab director e-mail to extra context
if hasattr(settings, 'TAB_DIRECTOR_EMAIL'):
data.setdefault('extra', {})
data['extra']['tab_director_email'] = settings.TAB_DIRECTOR_EMAIL

return data

0 comments on commit 4cff209

Please sign in to comment.