Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions gdpr/tests/__snapshots__/test_gdpr_api.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
'children': list([
dict({
'key': 'START_TIME',
'value': '2010-07-23T14:55:55.542261+00:00',
'value': '2000-01-15T19:13:18.149871+00:00',
}),
dict({
'key': 'END_TIME',
'value': '2008-11-04T18:51:30.730104+00:00',
'value': '1987-01-24T05:08:40.298940+00:00',
}),
dict({
'key': 'CREATED_AT',
Expand All @@ -36,7 +36,7 @@
'children': list([
dict({
'key': 'LINKED_EVENT_ID',
'value': 'FrTcm',
'value': 'Tcmct',
}),
dict({
'key': 'ORGANISATION',
Expand Down Expand Up @@ -65,11 +65,11 @@
}),
dict({
'key': 'UNIT_NAME',
'value': 'National since collection goal natural. Subject take stop debate.',
'value': 'Adult economy a to analysis senior officer. What method admit fact force.',
}),
dict({
'key': 'GROUP_SIZE',
'value': 857,
'value': 186,
}),
dict({
'key': 'AMOUNT_OF_ADULT',
Expand All @@ -81,7 +81,7 @@
}),
dict({
'key': 'EXTRA_NEEDS',
'value': 'Whose our politics contain blood interview. Cup must tough edge part. Respond pressure people.',
'value': 'So two avoid use actually difficult. House society blood trial. Top really study young whose our.',
}),
dict({
'key': 'PREFERRED_TIMES',
Expand Down Expand Up @@ -178,11 +178,11 @@
'children': list([
dict({
'key': 'LINKED_EVENT_ID',
'value': 'NoYfT',
'value': 'EguWh',
}),
dict({
'key': 'ORGANISATION',
'value': 'Rosario and Sons',
'value': 'Allen and Sons',
}),
dict({
'key': 'CONTACT_PERSON',
Expand Down Expand Up @@ -483,11 +483,11 @@
'children': list([
dict({
'key': 'START_TIME',
'value': '2010-07-23T14:55:55.542261+00:00',
'value': '2000-01-15T19:13:18.149871+00:00',
}),
dict({
'key': 'END_TIME',
'value': '2008-11-04T18:51:30.730104+00:00',
'value': '1987-01-24T05:08:40.298940+00:00',
}),
dict({
'key': 'CREATED_AT',
Expand All @@ -501,7 +501,7 @@
'children': list([
dict({
'key': 'LINKED_EVENT_ID',
'value': 'FrTcm',
'value': 'Tcmct',
}),
dict({
'key': 'ORGANISATION',
Expand Down Expand Up @@ -605,11 +605,11 @@
'children': list([
dict({
'key': 'LINKED_EVENT_ID',
'value': 'NoYfT',
'value': 'EguWh',
}),
dict({
'key': 'ORGANISATION',
'value': 'Rosario and Sons',
'value': 'Allen and Sons',
}),
dict({
'key': 'CONTACT_PERSON',
Expand Down Expand Up @@ -641,11 +641,11 @@
'children': list([
dict({
'key': 'START_TIME',
'value': '2010-07-23T14:55:55.542261+00:00',
'value': '2000-01-15T19:13:18.149871+00:00',
}),
dict({
'key': 'END_TIME',
'value': '2008-11-04T18:51:30.730104+00:00',
'value': '1987-01-24T05:08:40.298940+00:00',
}),
dict({
'key': 'CREATED_AT',
Expand All @@ -659,7 +659,7 @@
'children': list([
dict({
'key': 'LINKED_EVENT_ID',
'value': 'FrTcm',
'value': 'Tcmct',
}),
dict({
'key': 'ORGANISATION',
Expand Down
2 changes: 2 additions & 0 deletions occurrences/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class Meta:


class EventQueueEnrolmentFactory(factory.django.DjangoModelFactory):
is_part_of_cultural_route = factory.Faker("boolean")
study_group = factory.SubFactory(StudyGroupFactory)
p_event = factory.SubFactory(PalvelutarjotinEventFactory)
person = factory.SubFactory(PersonFactory)
Expand All @@ -129,6 +130,7 @@ class Meta:


class EnrolmentFactory(factory.django.DjangoModelFactory):
is_part_of_cultural_route = factory.Faker("boolean")
study_group = factory.SubFactory(StudyGroupFactory)
occurrence = factory.SubFactory(OccurrenceFactory)
person = factory.SubFactory(PersonFactory)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("occurrences", "0044_add_group_name_to_studygroup_order_by"),
]

operations = [
migrations.AddField(
model_name="enrolment",
name="is_part_of_cultural_route",
field=models.BooleanField(
default=False,
help_text="Is enrolment part of a cultural route? True means yes, False means no, I don't know or unanswered.",
verbose_name="is part of cultural route",
),
preserve_default=False,
),
migrations.AddField(
model_name="eventqueueenrolment",
name="is_part_of_cultural_route",
field=models.BooleanField(
default=False,
help_text="Is enrolment part of a cultural route? True means yes, False means no, I don't know or unanswered.",
verbose_name="is part of cultural route",
),
preserve_default=False,
),
]
8 changes: 8 additions & 0 deletions occurrences/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,13 @@ def user_can_view(self, user: User):


class EnrolmentBase(WithDeletablePersonModel):
is_part_of_cultural_route = models.BooleanField(
verbose_name=_("is part of cultural route"),
help_text=_(
"Is enrolment part of a cultural route? "
"True means yes, False means no, I don't know or unanswered."
),
Comment thread
karisal-anders marked this conversation as resolved.
Comment thread
karisal-anders marked this conversation as resolved.
)
Comment thread
danipran marked this conversation as resolved.
notification_type = models.CharField(
max_length=250,
choices=NOTIFICATION_TYPES,
Expand Down Expand Up @@ -976,6 +983,7 @@ def create_enrolment(self, occurrence: Occurrence):
enrolment = Enrolment(
occurrence=occurrence,
study_group=self.study_group,
is_part_of_cultural_route=self.is_part_of_cultural_route,
notification_type=self.notification_type,
person=self.person,
)
Expand Down
17 changes: 16 additions & 1 deletion occurrences/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,13 @@ class StudyGroupInput(graphene.InputObjectType):

class EnrolInputBase:
study_group = StudyGroupInput(description="Study group data", required=True)
is_part_of_cultural_route = graphene.Boolean(
description=(
"Is the enrolment part of a cultural route? "
"False = No / I don't know, True = Yes."
),
required=True,
)
Comment thread
karisal-anders marked this conversation as resolved.
Comment thread
karisal-anders marked this conversation as resolved.
notification_type = NotificationTypeEnum()
person = PersonNodeInput(
description="Leave blank if the contact person is "
Expand Down Expand Up @@ -747,6 +754,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
p_event = PalvelutarjotinEvent.objects.get(id=p_event_id)
study_group = create_study_group(kwargs.pop("study_group"))
contact_person_data = kwargs.pop("person", None)
is_part_of_cultural_route = kwargs.pop("is_part_of_cultural_route")
Comment thread
karisal-anders marked this conversation as resolved.
Comment thread
karisal-anders marked this conversation as resolved.
notification_type = kwargs.pop(
"notification_type",
EventQueueEnrolment._meta.get_field("notification_type").get_default(),
Expand All @@ -760,6 +768,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
study_group=study_group,
p_event=p_event,
person=person,
is_part_of_cultural_route=is_part_of_cultural_route,
notification_type=notification_type,
)
return EnrolEventQueueMutation(event_queue_enrolment=event_queue_enrolment)
Expand Down Expand Up @@ -860,6 +869,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
kwargs.pop("captcha_key", None)
study_group = create_study_group(kwargs.pop("study_group"))
contact_person_data = kwargs.pop("person", None)
is_part_of_cultural_route = kwargs.pop("is_part_of_cultural_route")
Comment thread
karisal-anders marked this conversation as resolved.
Comment thread
karisal-anders marked this conversation as resolved.
notification_type = kwargs.pop(
"notification_type",
Enrolment._meta.get_field("notification_type").get_default(),
Expand All @@ -880,6 +890,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
study_group=study_group,
occurrences=occurrences,
person=person,
is_part_of_cultural_route=is_part_of_cultural_route,
notification_type=notification_type,
send_notifications_on_auto_acceptance=send_notifications,
)
Expand Down Expand Up @@ -921,6 +932,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
class UpdateEnrolmentMutation(graphene.relay.ClientIDMutation):
class Input:
enrolment_id = graphene.GlobalID()
is_part_of_cultural_route = graphene.Boolean(required=False)
notification_type = NotificationTypeEnum()
study_group = StudyGroupInput(description="Study group input")
person = PersonNodeInput(
Expand All @@ -935,9 +947,12 @@ class Input:
@transaction.atomic
@map_enums_to_values_in_kwargs
def mutate_and_get_payload(cls, root, info, **kwargs):
enrolment = get_editable_obj_from_global_id(
enrolment: Enrolment = get_editable_obj_from_global_id(
info, kwargs.pop("enrolment_id"), Enrolment
)
# Use enrolment's existing value if not given or given None:
if kwargs.get("is_part_of_cultural_route") is None:
kwargs["is_part_of_cultural_route"] = enrolment.is_part_of_cultural_route
study_group = enrolment.study_group
study_group_data = kwargs.pop("study_group", None)
if study_group_data:
Expand Down
4 changes: 4 additions & 0 deletions occurrences/schema_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ def enrol_to_occurrence(
study_group: StudyGroup,
occurrences: List[Occurrence],
person: Person,
is_part_of_cultural_route: bool,
notification_type,
send_notifications_on_auto_acceptance=True,
):
Expand All @@ -272,6 +273,7 @@ def enrol_to_occurrence(
study_group=study_group,
occurrence=occurrence,
person=person,
is_part_of_cultural_route=is_part_of_cultural_route,
notification_type=notification_type,
)

Expand Down Expand Up @@ -300,6 +302,7 @@ def enrol_to_event_queue(
study_group: StudyGroup,
p_event: PalvelutarjotinEvent,
person: Person,
is_part_of_cultural_route: bool,
notification_type: str,
):
if not p_event.is_queueing_allowed:
Expand All @@ -315,6 +318,7 @@ def enrol_to_event_queue(
p_event=p_event,
study_group=study_group,
person=person,
is_part_of_cultural_route=is_part_of_cultural_route,
notification_type=notification_type,
enrolment_time=timezone.now(),
)
Expand Down
13 changes: 8 additions & 5 deletions occurrences/tests/__snapshots__/test_api.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,8 @@
}),
'status': 'HAS_NO_ENROLMENTS',
'studyGroup': dict({
'groupName': 'Away watch above bad car. List short color produce include threat.',
'preferredTimes': 'Street sign education field.',
'groupName': 'That story claim. Case skin machine. Congress night street good break likely skill.',
'preferredTimes': 'Much theory pay color fight.',
}),
}),
}),
Expand All @@ -1005,7 +1005,10 @@
}),
'status': 'HAS_NO_ENROLMENTS',
'studyGroup': dict({
'groupName': 'Before charge difficult number. Leave part and test benefit.',
'groupName': '''
These international majority stuff.
Poor crime chair eight. Leave part and test benefit.
''',
'preferredTimes': 'Hotel near deal.',
}),
}),
Expand Down Expand Up @@ -1056,8 +1059,8 @@
}),
'status': 'HAS_NO_ENROLMENTS',
'studyGroup': dict({
'groupName': 'Project hope eight week still. Mission program point piece simple too walk. Talk hand price author.',
'preferredTimes': 'On performance detail sure.',
'groupName': 'Focus author huge great. Institution more happen million hit listen.',
'preferredTimes': 'House hear culture.',
}),
}),
}),
Expand Down
8 changes: 4 additions & 4 deletions occurrences/tests/__snapshots__/test_notifications.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,17 @@
no-reply@hel.ninja|['brett47@example.com']|Occurrence enrolment EN|
Event EN: Raija Malka & Kaija Saariaho: Blick
Extra event info: ytHjL
Study group: Close term where up notice environment father stay. Hold project month similar support line.
Study group: Stop available listen specific.
Occurrence: 18.04.2002 09.53
Person: sandra56@example.net
Person: srobinson@example.net
''',
'''
no-reply@hel.ninja|['brett47@example.com']|Occurrence unenrolment EN|
Event EN: Raija Malka & Kaija Saariaho: Blick
Extra event info: ytHjL
Study group: Close term where up notice environment father stay. Hold project month similar support line.
Study group: Stop available listen specific.
Occurrence: 18.04.2002 09.53
Person: sandra56@example.net
Person: srobinson@example.net
''',
])
# ---
Expand Down
Loading
Loading