You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the main admin results page, this query occurs as many times as there are debates:
SELECT (1) AS "a"
FROM "tournaments_round"
WHERE ("tournaments_round"."tournament_id" = 1 AND "tournaments_round"."seq" > 1)
LIMIT 1
Last few lines of stack trace:
/home/czlee/tabbycat/tabbycat/tournaments/models.py in debate_set_with_prefetches(519)
populate_confirmed_ballots(debates, motions=True, results=True)
/home/czlee/tabbycat/tabbycat/results/prefetch.py in populate_confirmed_ballots(66)
populate_results(confirmed_ballots)
/home/czlee/tabbycat/tabbycat/results/prefetch.py in populate_results(100)
result.init_blank_buffer()
/home/czlee/tabbycat/tabbycat/results/result.py in init_blank_buffer(624)
super().init_blank_buffer()
/home/czlee/tabbycat/tabbycat/results/result.py in init_blank_buffer(765)
if len(self.sides) == 4 and self.debate.round.is_last:
/home/czlee/tabbycat/tabbycat/tournaments/models.py in is_last(579)
return not self._rounds_in_same_sequence().filter(seq__gt=self.seq).order_by('seq').exists()
I think the check for whether there should be one or two winners in BP debates is causing it:
The quick hackish way to result this would be to make Round.is_last a cached_property, but I didn't want to just do that in case there was some structurally better way to go about this, following the refactoring in #1180. We presumably want the information about the round to be passed cleanly to all the result objects or something, from populate_results() or maybe even from debate_set_with_prefetches(). (But I'm fine with just modifying Round.is_last if that's what should happen.)
To avoid calling round.is_last as often, the conditions that lead to
that point were expanded and analyzed (added parentheses too) to make
sure the right result class is used.
Then, for ConsensusDebateResult, the condition for having just 1 team
advance in BP now directly tests if the scoresheet is correct. So, the
.is_last method is only called for BP outrounds.
Ref #1704
To avoid calling round.is_last as often, the conditions that lead to
that point were expanded and analyzed (added parentheses too) to make
sure the right result class is used.
Then, for ConsensusDebateResult, the condition for having just 1 team
advance in BP now directly tests if the scoresheet is correct. So, the
.is_last method is only called for BP outrounds.
Ref #1704
On the main admin results page, this query occurs as many times as there are debates:
Last few lines of stack trace:
I think the check for whether there should be one or two winners in BP debates is causing it:
tabbycat/tabbycat/results/result.py
Lines 762 to 766 in 04541b0
The quick hackish way to result this would be to make
Round.is_last
acached_property
, but I didn't want to just do that in case there was some structurally better way to go about this, following the refactoring in #1180. We presumably want the information about the round to be passed cleanly to all the result objects or something, frompopulate_results()
or maybe even fromdebate_set_with_prefetches()
. (But I'm fine with just modifyingRound.is_last
if that's what should happen.)(@tienne-B, thoughts?)
The text was updated successfully, but these errors were encountered: