def choose_new_question_and_asker(self, room_id, asker=None): if asker is None: next_asker = Database.get_next_asker(room_id) else: next_asker = asker emit("asker_chosen", {"asker": next_asker}, json=True, broadcast=True) generated_question = Database.get_question(room_id) if generated_question is None: emit("game_over", "", broadcast=True) else: potential_receivers = Database.get_potential_receivers(room_id) emit("generated_question", { "question": generated_question, "potential_receivers": potential_receivers }, json=True, room=Database.get_session_id(room_id, next_asker))
user_id = 'id4' session_id = 's4' name = 'D' print("+-> ", Database.create_player(room_id, name, session_id, user_id)) print("Setting askers order") print(Database.set_askers_order(room_id)) print("Current asker - " + Database.get_current_asker(room_id)) print("Current asker - " + Database.get_current_asker(room_id)) print("Next asker set - " + Database.get_next_asker(room_id)) print("Current asker - " + Database.get_current_asker(room_id)) print("Next asker set - " + Database.get_next_asker(room_id)) print("Next asker set - " + Database.get_next_asker(room_id)) print("Next asker set - " + Database.get_next_asker(room_id)) print("Set last receiver", Database.set_last_receiver(room_id, 'B')) print("Poten receiv", Database.get_potential_receivers(room_id)) print("Set last receiver", Database.set_last_receiver(room_id, 'X')) print("Set last receiver", Database.set_last_receiver(-1, 'B')) print("Poten receiv", Database.get_potential_receivers(-1)) print("PL: ", Database.get_players(room_id)) print("Del player", Database.delete_player(room_id, 'A')) print(Database.get()) print("Del room", Database.delete_room(room_id)) print(Database.get())