Easy way to restart an activity without quitting.
modified: app.py modified: research/activity27-tic-tac-toe.yaml modified: research/activity28-killer-squares.yaml
This commit is contained in:
parent
2e82ddc563
commit
41dff2865a
3 changed files with 48 additions and 20 deletions
5
app.py
5
app.py
|
|
@ -212,6 +212,8 @@ class ActivityState(db.Model):
|
|||
del metadata[key]
|
||||
self.dict_metadata = metadata
|
||||
|
||||
def clear_metadata(self):
|
||||
self.dict_metadata = {}
|
||||
|
||||
def get_room(room_name):
|
||||
"""Utility function to get room from room name."""
|
||||
|
|
@ -2363,6 +2365,9 @@ def handle_activity_response(room_name, user_response, username):
|
|||
room=room_name,
|
||||
)
|
||||
|
||||
if "metadata_clear" in transition and transition["metadata_clear"] == True:
|
||||
activity_state.clear_metadata()
|
||||
|
||||
print(activity_state.dict_metadata)
|
||||
|
||||
# Commit the changes after the loop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue