Skip to content

Commit 5a788da

Browse files
committed
Add field for participant in Submission
This commit adds a new field to Submission models as a Person foreign key. This field is then populated when using private URLs as an alternative to IP addresses (although still collected). With this, ballots can be more easily distinguished from which adjudicator had submitted the ballot. This is added to the "other ballots" list. It can also be used to find which team member submitted feedback, although not shown in any template.
1 parent f8ea5d0 commit 5a788da

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

tabbycat/adjfeedback/views.py

+5
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,11 @@ def get_team_short_name(self, team):
560560
def is_page_enabled(self, tournament):
561561
return tournament.pref('participant_feedback') == 'private-urls'
562562

563+
def get_submitter_fields(self):
564+
fields = super().get_submitter_fields()
565+
fields['from_participant'] = self.object
566+
return fields
567+
563568
def get_success_url(self):
564569
# Redirect to non-cached page: their original private URL
565570
if isinstance(self.object, Adjudicator):

tabbycat/results/models.py

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ class Submission(models.Model):
4242
confirmed = models.BooleanField(default=False,
4343
verbose_name=_("confirmed"))
4444

45+
# relevant for private URL submissions
46+
from_participant = models.ForeignKey('participants.Person', models.PROTECT,
47+
blank=True, null=True,
48+
verbose_name=_("from participant"))
49+
4550
# only relevant if submitter was in tab room
4651
submitter = models.ForeignKey(settings.AUTH_USER_MODEL, models.PROTECT,
4752
blank=True, null=True, related_name="%(app_label)s_%(class)s_submitted",

tabbycat/results/templates/ballot/other_ballots_list.html

+9-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ <h4 class="list-group-item-heading mb-0">
5050
entered by <strong>{{ submitter }}</strong>,
5151
{% endblocktrans %}
5252
{% elif other.submitter_type == ballotsub.SUBMITTER_PUBLIC %}
53-
{% blocktrans trimmed with ip_address=other.ip_address %}
54-
submitted from the public form on {{ ip_address }},
55-
{% endblocktrans %}
53+
{% if other.from_participant %}
54+
{% blocktrans trimmed with adjudicator=other.from_participant %}
55+
submitted from <strong>{{ adjudicator }}</strong>'s private URL,
56+
{% endblocktrans %}
57+
{% else %}
58+
{% blocktrans trimmed with ip_address=other.ip_address %}
59+
submitted from the public form on {{ ip_address }},
60+
{% endblocktrans %}
61+
{% endif %}
5662
{% endif %}
5763

5864
{% blocktrans trimmed with timestamp=other.timestamp timeago=other.timestamp|timesince %}

tabbycat/results/views.py

+4
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,10 @@ class OldPublicNewBallotSetByRandomisedUrlView(SingleObjectByRandomisedUrlMixin,
559559
allow_null_tournament = True
560560
private_url = True
561561

562+
def populate_objects(self):
563+
super().populate_objects()
564+
self.ballotsub.from_participant = Adjudicator.objects.get(url_key=self.kwargs['url_key'])
565+
562566
def get_success_url(self):
563567
return reverse_tournament('privateurls-person-index', self.tournament, kwargs={'url_key': self.kwargs['url_key']})
564568

0 commit comments

Comments
 (0)