Skip to content

Commit

Permalink
Remove application round target group
Browse files Browse the repository at this point in the history
  • Loading branch information
matti-lamppu committed Sep 3, 2024
1 parent b22aca6 commit bc3f4ad
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 27 deletions.
1 change: 0 additions & 1 deletion api/graphql/types/application_round/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class Meta:
fields = [
"pk",
"name",
"target_group",
"terms_of_use",
"criteria",
"notes_when_applying",
Expand Down
2 changes: 0 additions & 2 deletions applications/admin/application_round/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class Meta:
"name_fi": _("Name (Finnish)"),
"name_en": _("Name (English)"),
"name_sv": _("Name (Swedish)"),
"target_group": _("Target group"),
"reservation_units": _("Reservation units"),
"application_period_begin": _("Application period begin date and time"),
"application_period_end": _("Application period end date and time"),
Expand All @@ -83,7 +82,6 @@ class Meta:
"name_fi": _("Name that describes the application round in Finnish."),
"name_en": _("Name that describes the application round in English."),
"name_sv": _("Name that describes the application round in Swedish."),
"target_group": _("Target group of the application round."),
"reservation_units": _("Reservation units that can be applied for in this application round."),
"application_period_begin": _("Start date and time of the period when application can be sent."),
"application_period_end": _("End date and time of the period when application can be sent."),
Expand Down
7 changes: 0 additions & 7 deletions applications/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"ApplicationStatusChoice",
"OrganizationTypeChoice",
"Priority",
"TargetGroupChoice",
"Weekday",
"WeekdayChoice",
]
Expand Down Expand Up @@ -276,12 +275,6 @@ def can_reset(self) -> bool:
]


class TargetGroupChoice(models.TextChoices):
INTERNAL = "INTERNAL", pgettext_lazy("TargetGroup", "Internal")
PUBLIC = "PUBLIC", pgettext_lazy("TargetGroup", "Public")
ALL = "ALL", pgettext_lazy("TargetGroup", "All")


class OrganizationTypeChoice(models.TextChoices):
COMPANY = "COMPANY", pgettext_lazy("OrganizationType", "Company")
REGISTERED_ASSOCIATION = "REGISTERED_ASSOCIATION", pgettext_lazy("OrganizationType", "Registered association")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 5.0.7 on 2024-08-07 06:44

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("applications", "0092_remove_applicationround_service_sector"),
]

operations = [
migrations.RemoveField(
model_name="applicationround",
name="target_group",
),
]
6 changes: 2 additions & 4 deletions applications/models/application_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
ApplicationRoundReservationCreationStatusChoice,
ApplicationRoundStatusChoice,
ApplicationStatusChoice,
TargetGroupChoice,
)
from applications.querysets.application_round import ApplicationRoundQuerySet
from common.connectors import ApplicationRoundActionsConnector
Expand All @@ -33,7 +32,6 @@ class ApplicationRound(models.Model):
"""

name: str = models.CharField(max_length=255)
target_group: str = models.CharField(choices=TargetGroupChoice.choices, max_length=50)
criteria: str = models.TextField(default="")
notes_when_applying: str = models.TextField(blank=True, default="")

Expand Down Expand Up @@ -96,7 +94,7 @@ def __str__(self) -> str:

@lookup_property(skip_codegen=True)
def status() -> ApplicationRoundStatusChoice:
return models.Case(
return models.Case( # type: ignore[return-value]
models.When(
models.Q(sent_date__isnull=False),
then=models.Value(ApplicationRoundStatusChoice.RESULTS_SENT.value),
Expand Down Expand Up @@ -132,7 +130,7 @@ def _(self) -> ApplicationRoundStatusChoice:

@lookup_property(skip_codegen=True)
def status_timestamp() -> datetime:
return models.Case(
return models.Case( # type: ignore[return-value]
models.When(
models.Q(sent_date__isnull=False), # RESULTS_SENT
then=models.F("sent_date"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
from datetime import UTC, datetime, time, timedelta
from itertools import cycle

from applications.enums import (
ApplicantTypeChoice,
OrganizationTypeChoice,
Priority,
TargetGroupChoice,
Weekday,
WeekdayChoice,
)
from applications.enums import ApplicantTypeChoice, OrganizationTypeChoice, Priority, Weekday, WeekdayChoice
from applications.models import (
Address,
AllocatedTimeSlot,
Expand Down Expand Up @@ -95,7 +88,6 @@ def _create_application_rounds(
name_fi=f"Application Round {i}",
name_en=f"Application Round {i}",
name_sv=f"Application Round {i}",
target_group=random.choice(TargetGroupChoice.values),
application_period_begin=period[0],
application_period_end=period[1],
reservation_period_begin=period[0],
Expand Down
3 changes: 1 addition & 2 deletions tests/factories/application_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import factory
from factory import fuzzy

from applications.enums import ApplicationRoundStatusChoice, TargetGroupChoice
from applications.enums import ApplicationRoundStatusChoice
from applications.models import ApplicationRound
from common.date_utils import utc_start_of_day
from reservation_units.models import Purpose, ReservationUnit
Expand All @@ -23,7 +23,6 @@ class Meta:
exclude = ["timestamp"]

name = fuzzy.FuzzyText()
target_group = fuzzy.FuzzyChoice(choices=TargetGroupChoice.values)

timestamp = factory.LazyFunction(utc_start_of_day) # private helper (see Meta.exclude)

Expand Down
2 changes: 0 additions & 2 deletions tests/test_graphql_api/test_application_round/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def test_application_round_query__all_fields(graphql):
nameFi
nameEn
nameSv
targetGroup
criteriaFi
criteriaEn
criteriaSv
Expand Down Expand Up @@ -72,7 +71,6 @@ def test_application_round_query__all_fields(graphql):
"nameFi": application_round.name_fi,
"nameEn": application_round.name_en,
"nameSv": application_round.name_sv,
"targetGroup": application_round.target_group,
"criteriaFi": application_round.criteria_fi,
"criteriaEn": application_round.criteria_en,
"criteriaSv": application_round.criteria_sv,
Expand Down

0 comments on commit bc3f4ad

Please sign in to comment.