Skip to content

Commit

Permalink
Merge branch 'main' into fix-relation-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jsangmeister authored Sep 7, 2023
2 parents 491c154 + cba5d26 commit 9d4f014
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def update_instance(self, instance: Dict[str, Any]) -> Dict[str, Any]:
last_speaker_id, last_speaker = speaker_id, speaker
if last_speaker is None:
raise ActionException("There is no last speaker that can be re-added.")
elif last_speaker.get("point_of_order"):
raise ActionException(
"The last speaker is a point of order speaker and cannot be re-added."
)
assert isinstance(lowest_weight, int)

for speaker in speakers.values():
Expand All @@ -83,7 +87,5 @@ def update_instance(self, instance: Dict[str, Any]) -> Dict[str, Any]:
"id": last_speaker_id,
"begin_time": None,
"end_time": None,
"point_of_order": None,
"point_of_order_category_id": None,
"weight": lowest_weight - 1,
}
15 changes: 4 additions & 11 deletions tests/system/action/list_of_speakers/test_re_add_last.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,10 @@ def test_last_speaker_poos(self) -> None:
}
)
response = self.request("list_of_speakers.re_add_last", {"id": 111})
self.assert_status_code(response, 200)
self.assert_model_exists(
"speaker/223",
{
"list_of_speakers_id": 111,
"meeting_user_id": 42,
"begin_time": None,
"end_time": None,
"point_of_order": None,
"meeting_id": 222,
},
self.assert_status_code(response, 400)
assert (
"The last speaker is a point of order speaker and cannot be re-added."
in response.json["message"]
)

def test_last_speaker_also_in_waiting_list(self) -> None:
Expand Down

0 comments on commit 9d4f014

Please sign in to comment.