Skip to content

Commit

Permalink
Merge pull request #86 from computas/add-get-example-drawings-endpoin…
Browse files Browse the repository at this point in the history
…t-for-both-players

Add seperate endpoints for players
  • Loading branch information
andreasrberg authored Jul 23, 2024
2 parents 270be46 + a884bcd commit 7704b59
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/webapp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def view_high_score(json_data):


@socketio.on("getExampleDrawings")
def get_example_drawings(json_data):
def get_example_drawings(json_data, emitEndpoint="getExampleDrawings"):
"""
Get example drawings from the database
"""
Expand All @@ -213,8 +213,15 @@ def get_example_drawings(json_data):
label, number_of_images)
example_drawings = storage.get_images_from_relative_url(
example_drawing_urls)
emit("getExampleDrawings", json.dumps(example_drawings), room=game_id)
emit(emitEndpoint, json.dumps(example_drawings), room=game_id)

@socketio.on("getExampleDrawingsP1")
def get_example_drawings_player_1(json_data):
get_example_drawings(json_data, emitEndpoint="getExampleDrawingsP1")

@socketio.on("getExampleDrawingsP2")
def get_example_drawings_player_2(json_data):
get_example_drawings(json_data, emitEndpoint="getExampleDrawingsP2")

@socketio.on("classify")
def handle_classify(data, image, correct_label=None):
Expand Down

0 comments on commit 7704b59

Please sign in to comment.