@@ -710,6 +710,13 @@ class StudyGroupInput(graphene.InputObjectType):
710710
711711class EnrolInputBase :
712712 study_group = StudyGroupInput (description = "Study group data" , required = True )
713+ is_part_of_cultural_route = graphene .Boolean (
714+ description = (
715+ "Is the enrolment part of a cultural route? "
716+ "False = No / I don't know, True = Yes."
717+ ),
718+ required = True ,
719+ )
713720 notification_type = NotificationTypeEnum ()
714721 person = PersonNodeInput (
715722 description = "Leave blank if the contact person is "
@@ -747,6 +754,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
747754 p_event = PalvelutarjotinEvent .objects .get (id = p_event_id )
748755 study_group = create_study_group (kwargs .pop ("study_group" ))
749756 contact_person_data = kwargs .pop ("person" , None )
757+ is_part_of_cultural_route = kwargs .pop ("is_part_of_cultural_route" )
750758 notification_type = kwargs .pop (
751759 "notification_type" ,
752760 EventQueueEnrolment ._meta .get_field ("notification_type" ).get_default (),
@@ -760,6 +768,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
760768 study_group = study_group ,
761769 p_event = p_event ,
762770 person = person ,
771+ is_part_of_cultural_route = is_part_of_cultural_route ,
763772 notification_type = notification_type ,
764773 )
765774 return EnrolEventQueueMutation (event_queue_enrolment = event_queue_enrolment )
@@ -860,6 +869,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
860869 kwargs .pop ("captcha_key" , None )
861870 study_group = create_study_group (kwargs .pop ("study_group" ))
862871 contact_person_data = kwargs .pop ("person" , None )
872+ is_part_of_cultural_route = kwargs .pop ("is_part_of_cultural_route" )
863873 notification_type = kwargs .pop (
864874 "notification_type" ,
865875 Enrolment ._meta .get_field ("notification_type" ).get_default (),
@@ -880,6 +890,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
880890 study_group = study_group ,
881891 occurrences = occurrences ,
882892 person = person ,
893+ is_part_of_cultural_route = is_part_of_cultural_route ,
883894 notification_type = notification_type ,
884895 send_notifications_on_auto_acceptance = send_notifications ,
885896 )
@@ -921,6 +932,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
921932class UpdateEnrolmentMutation (graphene .relay .ClientIDMutation ):
922933 class Input :
923934 enrolment_id = graphene .GlobalID ()
935+ is_part_of_cultural_route = graphene .Boolean (required = False )
924936 notification_type = NotificationTypeEnum ()
925937 study_group = StudyGroupInput (description = "Study group input" )
926938 person = PersonNodeInput (
@@ -935,9 +947,13 @@ class Input:
935947 @transaction .atomic
936948 @map_enums_to_values_in_kwargs
937949 def mutate_and_get_payload (cls , root , info , ** kwargs ):
938- enrolment = get_editable_obj_from_global_id (
950+ enrolment : Enrolment = get_editable_obj_from_global_id (
939951 info , kwargs .pop ("enrolment_id" ), Enrolment
940952 )
953+ # Use enrolment's existing value if not given:
954+ kwargs ["is_part_of_cultural_route" ] = bool (
955+ kwargs .get ("is_part_of_cultural_route" , enrolment .is_part_of_cultural_route )
956+ )
941957 study_group = enrolment .study_group
942958 study_group_data = kwargs .pop ("study_group" , None )
943959 if study_group_data :
0 commit comments