Fix bug when checking for assigned pilot in case tidal times are changed
This commit is contained in:
parent
e9a7e03ebf
commit
ab12e28d3d
@ -548,12 +548,16 @@ class InputValidationShipcall():
|
||||
assigned_agency = get_assigned_participant_of_type(shipcall_id, participant_type=ParticipantType.AGENCY)
|
||||
assigned_pilot = get_assigned_participant_of_type(shipcall_id, participant_type=ParticipantType.PILOT)
|
||||
an_agency_is_assigned = True if assigned_agency is not None else False
|
||||
a_pilot_is_assigned = True if assigned_pilot is not None else False
|
||||
|
||||
else:
|
||||
# Agency assigned? User must belong to the assigned agency or be a BSMD user, in case the flag is set
|
||||
assigned_agency = [spm for spm in shipcall_participant_map if int(spm.type) == int(ParticipantType.AGENCY)]
|
||||
assigned_pilot = [spm for spm in shipcall_participant_map if int(spm.type) == int(ParticipantType.PILOT)]
|
||||
an_agency_is_assigned = len(assigned_agency)==1
|
||||
a_pilot_is_assigned = len(assigned_pilot)==1
|
||||
if a_pilot_is_assigned:
|
||||
assigned_pilot = assigned_pilot[0]
|
||||
|
||||
if len(assigned_agency)>1:
|
||||
raise ValidationError({"internal_error":f"Internal error? Found more than one assigned agency for the shipcall with ID {shipcall_id}. Found: {assigned_agency}"})
|
||||
@ -569,7 +573,7 @@ class InputValidationShipcall():
|
||||
### USER authority ###
|
||||
# determine, whether the user is a) the assigned agency or b) a BSMD participant
|
||||
user_is_assigned_agency = (user_participant_id == assigned_agency.id)
|
||||
user_is_assigned_pilot = (user_participant_id == assigned_pilot.id)
|
||||
user_is_assigned_pilot = a_pilot_is_assigned and (user_participant_id == assigned_pilot.id)
|
||||
|
||||
# when the BSMD flag is set: the user must be either BSMD or the assigned agency
|
||||
# when the BSMD flag is not set: the user must be the assigned agency
|
||||
|
||||
Loading…
Reference in New Issue
Block a user