Skip to content

Instantly share code, notes, and snippets.

@nwingt
Last active August 17, 2016 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwingt/361eb8ca0aae516504191b8d3d076ef4 to your computer and use it in GitHub Desktop.
Save nwingt/361eb8ca0aae516504191b8d3d076ef4 to your computer and use it in GitHub Desktop.
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