def insert_earned_achievement(aid, data):
"""
Store earned achievement for a user/team.
Args:
aid: the achievement id
data: the data necessary to assess the achievement
must include tid, uid
"""
db = api.common.get_conn()
tid, uid = data.pop("tid"), data.pop("uid")
name, description = data.pop("name"), data.pop("description")
db.earned_achievements.insert({
"aid": aid,
"tid": tid,
"uid": uid,
"data": data,
"name": name,
"description": description,
"timestamp": datetime.utcnow().timestamp(),
"seen": False
})
评论列表
文章目录