BSMD-flag check was executed on the wrong ID. Now, it correctly uses the assigned agency's ID to determine the presence of a BSMD flag
This commit is contained in:
parent
aaea8441f6
commit
8df9034574
@ -465,6 +465,9 @@ class InputValidationShipcall():
|
|||||||
def check_shipcall_id_exists(loadedModel):
|
def check_shipcall_id_exists(loadedModel):
|
||||||
"""simply checks, whether the defined shipcall ID exists in the database. Otherwise, a PUT-request must fail."""
|
"""simply checks, whether the defined shipcall ID exists in the database. Otherwise, a PUT-request must fail."""
|
||||||
shipcall_id = loadedModel.get("id")
|
shipcall_id = loadedModel.get("id")
|
||||||
|
if shipcall_id is None:
|
||||||
|
raise ValidationError({"id":"a shipcall id must be provided"})
|
||||||
|
|
||||||
query = 'SELECT * FROM shipcall where (id = ?shipcall_id?)'
|
query = 'SELECT * FROM shipcall where (id = ?shipcall_id?)'
|
||||||
shipcalls = execute_sql_query_standalone(query=query, model=Shipcall, param={"shipcall_id" : shipcall_id})
|
shipcalls = execute_sql_query_standalone(query=query, model=Shipcall, param={"shipcall_id" : shipcall_id})
|
||||||
if len(shipcalls)==0:
|
if len(shipcalls)==0:
|
||||||
@ -509,7 +512,7 @@ class InputValidationShipcall():
|
|||||||
|
|
||||||
# determine, whether the assigned agency has set the BSMD-flag to allow BSMD users to edit their assigned shipcalls
|
# determine, whether the assigned agency has set the BSMD-flag to allow BSMD users to edit their assigned shipcalls
|
||||||
query = 'SELECT * FROM participant where (id = ?participant_id?)'
|
query = 'SELECT * FROM participant where (id = ?participant_id?)'
|
||||||
agency_participant = execute_sql_query_standalone(query=query, param={"participant_id" : participant_id}, command_type="single", model=Participant)
|
agency_participant = execute_sql_query_standalone(query=query, param={"participant_id" : assigned_agency.participant_id}, command_type="single", model=Participant)
|
||||||
|
|
||||||
assert isinstance(agency_participant.flags, int), f"this method has currently only been developed with 'flags' being set as an integer. Found: {type(agency_participant.flags)}"
|
assert isinstance(agency_participant.flags, int), f"this method has currently only been developed with 'flags' being set as an integer. Found: {type(agency_participant.flags)}"
|
||||||
agency_has_bsmd_flag = agency_participant.flags==1 # once the flags are an IntFlag, change the boolean check to: (ParticipantFlag.BSMD in agency_participant.flags)
|
agency_has_bsmd_flag = agency_participant.flags==1 # once the flags are an IntFlag, change the boolean check to: (ParticipantFlag.BSMD in agency_participant.flags)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user