internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: TabbycatDebate/tabbycat

Issue:
Ignored feedback appears to still contribute to adjudicator average
Just a small thing from a recent tournament; when certain pieces of feedback were marked in the admin interface as 'ignored', the adjudicator's metrics did not update to reflect that (ie. the ignored score was still counting towards their numbers).


Discussion:

Resolving patch:
diff --git a/tabbycat/participants/models.py b/tabbycat/participants/models.py
--- a/tabbycat/participants/models.py
+++ b/tabbycat/participants/models.py
@@ -450,7 +450,7 @@ def _feedback_score(self):
             return self._feedback_score_cache
         except AttributeError:
             from adjallocation.models import DebateAdjudicator
-            self._feedback_score_cache = self.adjudicatorfeedback_set.filter(confirmed=True).exclude(
+            self._feedback_score_cache = self.adjudicatorfeedback_set.filter(confirmed=True, ignored=False).exclude(
                 source_adjudicator__type=DebateAdjudicator.TYPE_TRAINEE).aggregate(
                     avg=models.Avg('score'))['avg']
             return self._feedback_score_cache
diff --git a/tabbycat/participants/prefetch.py b/tabbycat/participants/prefetch.py
--- a/tabbycat/participants/prefetch.py
+++ b/tabbycat/participants/prefetch.py
@@ -40,7 +40,8 @@ def populate_feedback_scores(adjudicators):
 
     adjfeedbacks = AdjudicatorFeedback.objects.filter(
         adjudicator_id__in=adjs_by_id.keys(),
-        confirmed=True
+        confirmed=True,
+        ignored=False,
     ).exclude(source_adjudicator__type=DebateAdjudicator.TYPE_TRAINEE)
 
     adjs_annotated = Adjudicator.objects.filter(


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Reply-to address warning linking to incorrect URL
Bug report on: 2.3.0A

The "not specified reply-to" warning on the Email Participant pages links to an incorrect URL for the notification preferences returning a 404 error.

Linked to: https://asd-2019-jo.herokuapp.com/jo2019central/admin/options/notifications/
Correct: https://asd-2019-jo.herokuapp.com/jo2019central/admin/options/email/

![image](https://user-images.githubusercontent.com/3196468/54529061-b4215d00-49e3-11e9-892b-d3ba81667f17.png)

![image](https://user-images.githubusercontent.com/3196468/54529110-cdc2a480-49e3-11e9-95c3-b559559a74f8.png)

UI Request: Add way to select/deselect all participants for the "email participants page"
UI feature request for 2.3.0A

The "Email Participants" page should have a way to select/deselect all participants from the page.

A screenshot has been included below of the Email Participants Adjudicator Assignments page. 

![image](https://user-images.githubusercontent.com/3196468/54528755-b931dc80-49e2-11e9-96d2-27520da6fe85.png)

@tienne-B thanks a lot for the new notification features, they make using emails tonnes easier and we are making good use of them already. Apologies for the stream of issues following this one. 


Discussion:

Resolving patch:
diff --git a/tabbycat/notifications/views.py b/tabbycat/notifications/views.py
--- a/tabbycat/notifications/views.py
+++ b/tabbycat/notifications/views.py
@@ -149,6 +149,8 @@ class BaseSelectPeopleEmailView(AdministratorMixin, TournamentMixin, VueTableTem
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         context['sg_webhook'] = EmailStatus.objects.filter(email__notification__tournament=self.tournament).exists()
+
+        context['categories'] = [{'id': 'spk', 'name': "Email"}]
         return context
 
     def get_default_send_queryset(self):


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Team partial check-in indicator doesn't work with 2+ speaker-teams
The team's partial check-in indicator (where the box on the 'check-ins' page has green and grey stripes) displays when only 1 speaker in a team is checked-in, but then turns grey again when more than 1 speaker is checked-in but the entire team is not checked-in.


Discussion:

Resolving patch:
diff --git a/tabbycat/checkins/views.py b/tabbycat/checkins/views.py
--- a/tabbycat/checkins/views.py
+++ b/tabbycat/checkins/views.py
@@ -51,6 +51,7 @@ def get_context_data(self, **kwargs):
         if self.scan_view:
             kwargs["scan_url"] = self.tournament.slug + '/checkins/'
         kwargs["for_admin"] = self.for_admin
+        kwargs["team_size"] = self.tournament.pref('substantive_speakers')
         return super().get_context_data(**kwargs)
 
 


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Email draw/custom email/motions page formatting error
Running the latest develop branch v2.3.0A.

The message box on the email draw/custom email motions page is obscured/broken as per the picture running Windows 10/Google Chrome. 

Error reproduced on a Mac/Google Chrome. 

![image](https://user-images.githubusercontent.com/3196468/62782659-cfb20f00-bb0e-11e9-92a2-915ee0cb558d.png)



Discussion:

Resolving patch:
diff --git a/tabbycat/notifications/forms.py b/tabbycat/notifications/forms.py
--- a/tabbycat/notifications/forms.py
+++ b/tabbycat/notifications/forms.py
@@ -27,4 +27,5 @@ class BasicEmailForm(forms.Form):
     Note that the list of recipients is handled by Vue, bypassing this Form."""
 
     subject_line = forms.CharField(label=_("Subject"), required=True, max_length=78)
-    message_body = forms.CharField(label=_("Message"), required=True, widget=SummernoteWidget(attrs={'height': 150}))
+    message_body = forms.CharField(label=_("Message"), required=True, widget=SummernoteWidget(
+        attrs={'height': 150, 'class': 'form-summernote'}))


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
2-team Team Tab calculates wins incorrectly
Screenshot below - Something appears to be wrong with how the results are being aggregated.

![2D8E4887-E3DD-4397-B651-9E746C153EB3](https://user-images.githubusercontent.com/29590417/64504616-cb4a6300-d313-11e9-9797-78b66dc3b381.png)



Discussion:
Hey, thanks for the report. I assume the standing settings are Australs-standard, and that this took place prior to `2.4.0a` being deployed? Also as a heads up, we are close to releasing `2.3.0` so `develop` is probably going to be less stable than usual as we merge in a few new features. (That said downgrading from 2.4 to 2.3 might also cause issues — maybe backup if going down that route).
I believe this is a regression in https://github.com/TabbycatDebate/tabbycat/commit/a89fe52683d7e0ed7e067eb6b9eae2598407bf4d#diff-366705728fbed3274cf3123ad0dfaab8L58-L59, which removed these two lines as part of merging #1155:
https://github.com/TabbycatDebate/tabbycat/blob/50a00846882d21255a3a6786c3161c83881eed11/tabbycat/standings/teams.py#L58-L59

Those two lines were added in 3444bde3bb7202e153d10a341f87e5c92956ee0b, which implemented the number of pullups as a team metric as part of #1090.

a89fe52683d7e0ed7e067eb6b9eae2598407bf4d has two parents: 50a00846882d21255a3a6786c3161c83881eed11 (the main line) and 8882188509ed11327c4a0f86231b9b31e89eeea1 (from PR #1155). The two lines were in the former, but not the latter.

However, the lines weren't actually removed as part of #1155, whose main commit is 4166decf50d66b5a1280de28d4bc8367b2273b58. Rather, 3444bde3bb7202e153d10a341f87e5c92956ee0b is an ancestor of 50a00846882d21255a3a6786c3161c83881eed11, but not 8882188509ed11327c4a0f86231b9b31e89eeea1, indicating that the addition of those two lines was overridden by the never-there-in-the-first-place of the PR, in a possible merge mishap.

Thanks for reporting this, @viranweerasekera!
We're dealing with some hard merges these times ;)

Resolving patch:
diff --git a/tabbycat/standings/teams.py b/tabbycat/standings/teams.py
--- a/tabbycat/standings/teams.py
+++ b/tabbycat/standings/teams.py
@@ -51,9 +51,10 @@ def get_annotation(self, round=None):
         )
         if round is not None:
             annotation_filter &= Q(debateteam__debate__round__seq__lte=round.seq)
+        if self.exclude_unconfirmed:
+            annotation_filter &= Q(debateteam__teamscore__ballot_submission__confirmed=True)
         if self.where_value is not None:
             annotation_filter &= Q(**{self.get_where_field(): self.where_value})
-
         return self.function(self.get_field(), filter=annotation_filter)
 
 


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Error message for BP voting ballots crashes with 500
Sentry Issue: [BACKEND-2BV](https://sentry.io/organizations/tabbycat/issues/1252961179/?referrer=github_integration)

```
AttributeError: 'tuple' object has no attribute 'replace'
(6 additional frame(s) were not displayed)
...
  File "django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "django/views/generic/base.py", line 158, in get
    context = self.get_context_data(**kwargs)
  File "options/views.py", line 54, in get_context_data
    "configuration to use consensus ballots."))
  File "django/utils/translation/__init__.py", line 79, in gettext
    return _trans.gettext(message)
  File "django/utils/translation/trans_real.py", line 282, in gettext
    eol_message = message.replace('\r\n', '\n').replace('\r', '\n')
```


Discussion:
Regression in https://github.com/TabbycatDebate/tabbycat/commit/4dc07d1dafcb036759ef565258fc387005033418#diff-bef4c60ef9bb83206005fddb45be97adR48, which was merged in #907.

This code is a tuple, and it should just be a single string:

https://github.com/TabbycatDebate/tabbycat/blob/4dc07d1dafcb036759ef565258fc387005033418/tabbycat/options/views.py#L48-L54

Resolving patch:
diff --git a/tabbycat/options/views.py b/tabbycat/options/views.py
--- a/tabbycat/options/views.py
+++ b/tabbycat/options/views.py
@@ -40,13 +40,13 @@ def get_context_data(self, **kwargs):
         if t.pref('teams_in_debate') == 'bp':
             if t.pref('ballots_per_debate_prelim') == 'per-adj' or \
                t.pref('ballots_per_debate_elim') == 'per-adj':
-                error = _(("Your draw rules specify four teams per-debate but ",
-                           "your ballot setting specifies that adjudicators ",
-                           "submit independent ballots. These settings ",
-                           "<strong>are not compatible and will cause results ",
-                           "entry to crash</strong>. You need to go back to ",
-                           "the Debate Rules settings and change your ",
-                           "configuration to use consensus ballots."))
+                error = _("Your draw rules specify four teams per-debate but "
+                          "your ballot setting specifies that adjudicators "
+                          "submit independent ballots. These settings "
+                          "<strong>are not compatible and will cause results "
+                          "entry to crash</strong>. You need to go back to "
+                          "the Debate Rules settings and change your "
+                          "configuration to use consensus ballots.")
                 messages.error(self.request, error)
 
         return super().get_context_data(**kwargs)


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Reporting of total speaks in emails uses integers rather than floats
This was a bug report to the FB page, just reposting here for better tracking and if anyone else wants to look at it. Haven't tried to reproduce/look at the code but the report seems clear

In the (default?) email template that is sent to adjs the line *Proposition: Team A (Loss - X total speaks)* reports *X total speaks* as an integer which can lead to incorrect totals in formats with half points. 


Discussion:

Resolving patch:
diff --git a/tabbycat/notifications/utils.py b/tabbycat/notifications/utils.py
--- a/tabbycat/notifications/utils.py
+++ b/tabbycat/notifications/utils.py
@@ -11,6 +11,7 @@
 thus the object itself cannot be passed.
 """
 
+from django.utils import formats
 from django.utils.safestring import mark_safe
 from django.utils.translation import gettext as _
 
@@ -108,16 +109,16 @@ def _create_ballot(result, scoresheet):
         for side, (side_name, pos_names) in zip(tournament.sides, side_and_position_names(tournament)):
             side_string = ""
             if tournament.pref('teams_in_debate') == 'bp':
-                side_string += _("<li>%(side)s: %(team)s (%(points)d points with %(speaks)d total speaks)")
+                side_string += _("<li>%(side)s: %(team)s (%(points)d points with %(speaks)s total speaks)")
                 points = 4 - scoresheet.rank(side)
             else:
-                side_string += _("<li>%(side)s: %(team)s (%(points)s - %(speaks)d total speaks)")
+                side_string += _("<li>%(side)s: %(team)s (%(points)s - %(speaks)s total speaks)")
                 points = _("Win") if side == scoresheet.winner() else _("Loss")
 
             ballot += side_string % {
                 'side': side_name,
                 'team': result.debateteams[side].team.code_name if use_codes else result.debateteams[side].team.short_name,
-                'speaks': scoresheet.get_total(side),
+                'speaks': formats.localize(scoresheet.get_total(side)),
                 'points': points
             }
 
@@ -127,7 +128,7 @@ def _create_ballot(result, scoresheet):
                 ballot += _("<li>%(pos)s: %(speaker)s (%(score)s)</li>") % {
                     'pos': pos_name,
                     'speaker': result.get_speaker(side, pos).name,
-                    'score': scoresheet.get_score(side, pos)
+                    'score': formats.localize(scoresheet.get_score(side, pos))
                 }
 
             ballot += "</ul></li>"


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Ballot Entry page should show debate venue 
The ballot entry page does not show the debate venue on it. Showing the venue can be helpful when locating where the ballot is, whether physically or online in this case (for this tournament, ballot are being submitted in a discord channel specific to a room but I need to go back to the main results entry page to work out where to find the mark sheet for the debate).

If I am not mistaken the old ballot entry page did show this?

![image](https://user-images.githubusercontent.com/3196468/83326144-a2189b00-a2c5-11ea-8773-3c20015e622e.png)



Discussion:

Resolving patch:
diff --git a/tabbycat/results/views.py b/tabbycat/results/views.py
--- a/tabbycat/results/views.py
+++ b/tabbycat/results/views.py
@@ -247,6 +247,10 @@ def get_context_data(self, **kwargs):
             kwargs['debate_name'] = _(" vs ").join(self.debate.get_team(side).short_name for side in sides)
         else:
             kwargs['debate_name'] = _(" vs ").join(self.debate.get_team(side).code_name for side in sides)
+        kwargs['page_subtitle'] = _("%(round)s @ %(room)s") % {
+            'round': self.debate.round.name,
+            'room': getattr(self.debate.venue, 'display_name', _("N/A")),
+        }
 
         kwargs['iron'] = self.debate.debateteam_set.annotate(iron=Count('team__debateteam__speakerscore',
             filter=Q(team__debateteam__debate__round=self.debate.round.prev) & Q(team__debateteam__speakerscore__ghost=True),


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Improve feedback introduction/explanation
The current feedback introduction/explanation field only allows you to enter a "single" line of text rather than a paragraph of text.

It would be preferable to provide a richer text editor here to allow more instructions to be provided.

An inter-related issue would be allowing the judge feedback scale to be inserted directly into the feedback form. This is helpful as often people are not familiar with the judge feedback scale and have to refer back to the original briefing slides/information. This would also preferably be in the form of a rich text editor.

The feedback scale could be solved by a richer text editor but also can be its own separate field displayed inline with the score question. 

The following gives an example of how I am currently implementing this.

![image](https://user-images.githubusercontent.com/3196468/83340169-0caef280-a329-11ea-81b6-ce0501049108.png)



Discussion:
Thanks for noting this. I don't think its documented, but HTML is valid in that textarea so you can use linebreaks and the like. A rich text field would be much better though.

Resolving patch:
diff --git a/tabbycat/options/preferences.py b/tabbycat/options/preferences.py
--- a/tabbycat/options/preferences.py
+++ b/tabbycat/options/preferences.py
@@ -410,12 +410,13 @@ class ShowUnaccredited(BooleanPreference):
 
 
 @tournament_preferences_registry.register
-class FeedbackIntroduction(StringPreference):
+class FeedbackIntroduction(LongStringPreference):
     help_text = _("Any explanatory text needed to introduce the feedback form")
     verbose_name = _("Feedback introduction/explanation")
     section = feedback
     name = 'feedback_introduction'
     default = ''
+    widget = SummernoteWidget(attrs={'height': 150, 'class': 'form-summernote'})
     field_kwargs = {'required': False}
 
 


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Break eligibility checkboxes don't have any effect
In the "break eligibility" view:

Expected behaviour: Clicking a checkbox should initiate a request to the server to toggle the team's break eligibility, and the server should send back a response so the front-end knows it has been saved.

Actual behavior: The checkbox toggles but no request appears to be sent from the browser. The server logs don't show any request when the checkbox is clicked.

Browser console:
![image](https://user-images.githubusercontent.com/1725499/85915378-db2c2880-b7fb-11ea-885b-473fd8837770.png)

Reported at https://www.facebook.com/groups/tabbycat.debate/permalink/1577099212458030/
Break eligibility checkboxes don't have any effect
In the "break eligibility" view:

Expected behaviour: Clicking a checkbox should initiate a request to the server to toggle the team's break eligibility, and the server should send back a response so the front-end knows it has been saved.

Actual behavior: The checkbox toggles but no request appears to be sent from the browser. The server logs don't show any request when the checkbox is clicked.

Browser console:
![image](https://user-images.githubusercontent.com/1725499/85915378-db2c2880-b7fb-11ea-885b-473fd8837770.png)

Reported at https://www.facebook.com/groups/tabbycat.debate/permalink/1577099212458030/


Discussion:

Resolving patch:
diff --git a/tabbycat/breakqual/views.py b/tabbycat/breakqual/views.py
--- a/tabbycat/breakqual/views.py
+++ b/tabbycat/breakqual/views.py
@@ -296,7 +296,7 @@ def get_table(self):
                 'checked': True if bc in team.break_categories.all() else False,
                 'sort': True if bc in team.break_categories.all() else False,
                 'id': team.id,
-                'type': bc.slug,
+                'type': bc.id,
             } for team in teams])
 
         # Provide list of members within speaker categories for convenient entry


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Summernote boxes don't show
I've had this happen a few times today, not sure if reliably reproducible yet. Only affects develop branch. Master branch works fine. Probably a dependency issue. Making a note so we remember to do something about it before Nebelung.

![image](https://user-images.githubusercontent.com/1725499/85212714-5d9f7e80-b30a-11ea-8f0f-362b7f7b8706.png)

![image](https://user-images.githubusercontent.com/1725499/85212739-8b84c300-b30a-11ea-9fdd-bbcab720f3f4.png)

Browser shows error:

> Refused to display 'https://hidden-caverns-06472.herokuapp.com/summernote/editor/id_tournament_staff/' in a frame because it set 'X-Frame-Options' to 'deny'.



Discussion:
Okay, it's a Django 3.0 thing.
https://docs.djangoproject.com/en/3.0/releases/3.0/#security
> `X_FRAME_OPTIONS` now defaults to `'DENY'`. In older versions, the `X_FRAME_OPTIONS` setting defaults to `'SAMEORIGIN'`. If your site uses frames of itself, you will need to explicitly set `X_FRAME_OPTIONS = 'SAMEORIGIN'` for them to continue working.

Readme file at https://github.com/summernote/django-summernote:
>5. If you're using Django 3.x with default SummernoteWidget, then
>     - Do not forget to set X_FRAME_OPTIONS = 'SAMEORIGIN' in your django settings.
>     - [Clickjacking Protection](https://docs.djangoproject.com/en/3.0/ref/clickjacking/)

We could just set `X_FRAME_OPTIONS` to `SAMEORIGIN`, though I sort of think it should be set just for pages from the django-summernote app, if that's possible.
Looking [at the threat model](https://docs.djangoproject.com/en/3.0/ref/clickjacking/) I think `sameorigin` wouldn’t be a concern although a per-page setting would be nice. 
Yeah, I agree with that assessment.

I opened https://github.com/summernote/django-summernote/pull/405, will see what the developer thinks 🙂
Hi guys. I've been looking at #1106 (seems like low-hanging fruit to start contributing with) and I've run into this problem too. Did we find a conclusion to this issue apart from setting a site-wide `sameorigin`?  
Hi @mitchellpalmer, it looks like @czlee's PR upstream isn't going anywhere fast. Given that I thing it would be great to add in the change to the site wide config. We can always walk it back if we are able to take a more targeted approach. 

Resolving patch:
diff --git a/tabbycat/settings/core.py b/tabbycat/settings/core.py
--- a/tabbycat/settings/core.py
+++ b/tabbycat/settings/core.py
@@ -276,6 +276,8 @@
     'iframe': True, # Necessary; if just to compartmentalise jQuery dependency,
 }
 
+X_FRAME_OPTIONS = 'SAMEORIGIN' # Necessary to get Django-Summernote working because of Django 3 changes
+
 # ==============================================================================
 # Database
 # ==============================================================================


Test patch:
Repository: TabbycatDebate/tabbycat

Issue:
Should we set DEFAULT_AUTO_FIELD?
Related to the Django 3.2 upgrade. Just thought this should be a conscious documented discussion rather than an informal one, since there seem to be (minor but nontrivial) consequences.

https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys:
> Maintaining the historical behavior, the default value for `DEFAULT_AUTO_FIELD` is `AutoField`. Starting with 3.2 new projects are generated with `DEFAULT_AUTO_FIELD` set to `BigAutoField`. Also, new apps are generated with `AppConfig.default_auto_field` set to `BigAutoField`. In a future Django release the default value of `DEFAULT_AUTO_FIELD` will be changed to `BigAutoField`.

But migrations aren't seamless. https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-DEFAULT_AUTO_FIELD:
> Unfortunately, the primary keys of existing auto-created through tables cannot currently be updated by the migrations framework.
> 
> This means that if you switch the value of `DEFAULT_AUTO_FIELD` and then generate migrations, the primary keys of the related models will be updated, as will the foreign keys from the through table, but the primary key of the auto-created through table will not be migrated.

To me the path of least resistance would be to set `DEFAULT_AUTO_FIELD` to `AutoField`, and kick the `BigAutoField` can down the road until (maybe) migrations work for it without manually added code, or until it becomes necessary. I can't imagine hitting 2 billion entries (what I presume the `AutoField` limit would be) in a table in a Tabbycat instance any time soon. But there's nothing prohibitive about `BigAutoField` migration, if others would prefer to get this change out of the way.


Discussion:
@tienne-B should we set this before Ocicat?

Resolving patch:
diff --git a/tabbycat/settings/core.py b/tabbycat/settings/core.py
--- a/tabbycat/settings/core.py
+++ b/tabbycat/settings/core.py
@@ -301,6 +301,8 @@
     },
 }
 
+DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
+
 # ==============================================================================
 # Channels
 # ==============================================================================


Test patch: