Skip to content

Commit bb9bbed

Browse files
authored
feat: isolate venue results from country and international results (#970)
* add is_isolated flag to venue * hide isolated venue from country and international results
1 parent 11112ed commit bb9bbed

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

bullet/bullet_admin/forms/venues.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ class Meta:
2525
"accepted_languages",
2626
"local_start",
2727
"is_online",
28+
"is_isolated",
2829
"registration_flow_type",
2930
]
3031
labels = {
3132
"shortcode": "Barcode prefix",
3233
"name": "Place",
3334
"category": "Category",
35+
"is_isolated": "Isolated results",
3436
"is_online": "Online venue",
3537
"registration_flow_type": "Registration flow",
3638
}
@@ -44,6 +46,8 @@ class Meta:
4446
"accepted_languages": "These languages can be selected when teams "
4547
"register.",
4648
"registration_flow_type": "Only change if you know what you are doing.",
49+
"is_isolated": "Teams from this venue won't be shown in country-wide "
50+
"and international results.",
4751
}
4852

4953
widgets = {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 5.1 on 2024-12-15 15:05
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("competitions", "0032_wildcard_category_alter_wildcard_competition"),
9+
]
10+
11+
operations = [
12+
migrations.AddField(
13+
model_name="venue",
14+
name="is_isolated",
15+
field=models.BooleanField(default=False),
16+
),
17+
]

bullet/competitions/models/venues.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class RegistrationFlowType(models.IntegerChoices):
106106
participants_hidden = models.BooleanField(default=False) # unused
107107

108108
is_online = models.BooleanField(default=False)
109+
is_isolated = models.BooleanField(default=False)
109110
is_reviewed = models.BooleanField(default=False)
110111

111112
registration_flow_type = models.IntegerField(

bullet/problems/logic/results.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ def get_country_results(
4141
country: str | Country, category: Category, time: timedelta = None
4242
) -> QuerySet[ResultRow]:
4343
return get_results(
44-
Q(team__venue__category=category, team__school__country=country),
44+
Q(
45+
team__venue__category=category,
46+
team__school__country=country,
47+
team__venue__is_isolated=False,
48+
),
4549
time,
4650
)
4751

@@ -50,7 +54,7 @@ def get_category_results(
5054
category: Category, time: timedelta = None
5155
) -> QuerySet[ResultRow]:
5256
return get_results(
53-
Q(team__venue__category=category),
57+
Q(team__venue__category=category, team__venue__is_isolated=False),
5458
time,
5559
)
5660

0 commit comments

Comments
 (0)