Skip to content

Commit

Permalink
participant id to participants ids 2nd try
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekkalbarczyk committed Aug 31, 2021
1 parent fe283d1 commit cc75c54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/resources/hacknight.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ def delete(self, id):
hacknight = Hacknight.query.get_or_404(id)
participants = {participant.id for participant in hacknight.participants}
json_data = request.get_json(force=True)
ids_schema = Schema.from_dict({"participant_ids": fields.List(fields.Int())})
ids_schema = Schema.from_dict({"participants_ids": fields.List(fields.Int())})
try:
data = ids_schema().load(json_data)
except ValidationError as err:
return err.messages, HTTPStatus.UNPROCESSABLE_ENTITY

to_remove = participants.intersection(set(data["participant_ids"]))
to_remove = participants.intersection(set(data["participants_ids"]))
if not to_remove:
return {"message": "No participant to delete"}, HTTPStatus.BAD_REQUEST
hacknight.participants = [
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/modules/hacknight.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ export default {
commit('raiseError', error);
});
},
deleteParticipants({ commit, getters }, participant_ids) {
deleteParticipants({ commit, getters }, participants_ids) {
axios
.delete(`/api/hacknights/${getters.getHacknight.id}/participants/`, {
data: {
participant_ids: participant_ids
participants_ids: participants_ids
}
})
.then(res => {
Expand Down

0 comments on commit cc75c54

Please sign in to comment.