Last active
August 17, 2016 05:45
-
-
Save nwingt/361eb8ca0aae516504191b8d3d076ef4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _save_game_record_in_table(table_name, game_record_id, user_id, score = 0, difficulty = 0): | |
container = SkygearContainer(api_key=MASTER_KEY, user_id=user_id) | |
container.send_action('record:save', { | |
'database_id': '_public', | |
'records': [{ | |
'_id': table_name + '/' + str(game_record_id), | |
'_access': [], | |
'user_id': { | |
'$id': 'user/' + user_id, | |
'$type': 'ref' | |
}, | |
'score': score, | |
'difficulty': difficulty | |
}] | |
}) | |
@skygear.every("@every 5s") | |
def update_game_records(): | |
table_name = 'game_records' | |
user_id = '2d2300f5-7659-4b7d-a91d-78fa89b2be12' | |
_save_game_record_in_table('game_record_personal', uuid.uuid4(), user_id, 25, 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment