@@ -884,13 +884,13 @@ def mutate(self, info, fcm_token, days_of_week, gyms, capacity_percent):
884884class EditCapacityReminder (graphene .Mutation ):
885885 class Arguments :
886886 reminder_id = graphene .Int (required = True )
887- gyms = graphene .List (graphene .String , required = True )
887+ new_gyms = graphene .List (graphene .String , required = True )
888888 days_of_week = graphene .List (graphene .String , required = True )
889- capacity_percent = graphene .Int (required = True )
889+ new_capacity_threshold = graphene .Int (required = True )
890890
891891 Output = CapacityReminder
892892
893- def mutate (self , info , reminder_id , gyms , days_of_week , capacity_percent ):
893+ def mutate (self , info , reminder_id , new_gyms , days_of_week , new_capacity_threshold ):
894894 reminder = db_session .query (CapacityReminderModel ).filter_by (id = reminder_id ).first ()
895895 if not reminder :
896896 raise GraphQLError ("CapacityReminder not found." )
@@ -904,10 +904,10 @@ def mutate(self, info, reminder_id, gyms, days_of_week, capacity_percent):
904904 raise GraphQLError (f"Invalid day of the week: { day } " )
905905
906906 # Validate gyms
907- valid_gyms = []
908- for gym in gyms :
907+ new_valid_gyms = []
908+ for gym in new_gyms :
909909 try :
910- valid_gyms .append (CapacityReminderGymGraphQLEnum [gym ].value )
910+ new_valid_gyms .append (CapacityReminderGymGraphQLEnum [gym ].value )
911911 except KeyError :
912912 raise GraphQLError (f"Invalid gym: { gym } " )
913913
@@ -925,7 +925,7 @@ def mutate(self, info, reminder_id, gyms, days_of_week, capacity_percent):
925925 raise GraphQLError (f"Error subscribing to topic: { error } " )
926926
927927 # Subscribe to new reminders
928- topics = [f"{ gym } _{ day } _{ reminder . capacity_threshold } " for gym in valid_gyms for day in validated_workout_days ]
928+ topics = [f"{ gym } _{ day } _{ new_capacity_threshold } " for gym in new_valid_gyms for day in validated_workout_days ]
929929
930930 for topic in topics :
931931 try :
@@ -935,9 +935,9 @@ def mutate(self, info, reminder_id, gyms, days_of_week, capacity_percent):
935935 except Exception as error :
936936 raise GraphQLError (f"Error subscribing to topic: { error } " )
937937
938- reminder .gyms = valid_gyms
938+ reminder .gyms = new_valid_gyms
939939 reminder .days_of_week = validated_workout_days
940- reminder .capacity_threshold = capacity_percent
940+ reminder .capacity_threshold = new_capacity_threshold
941941
942942 db_session .commit ()
943943 return reminder
0 commit comments