本文整理汇总了Python中models.user.UserModel.newTrust方法的典型用法代码示例。如果您正苦于以下问题:Python UserModel.newTrust方法的具体用法?Python UserModel.newTrust怎么用?Python UserModel.newTrust使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.UserModel
的用法示例。
在下文中一共展示了UserModel.newTrust方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calc_new_trust
# 需要导入模块: from models.user import UserModel [as 别名]
# 或者: from models.user.UserModel import newTrust [as 别名]
def calc_new_trust(self):
winner = AnswerModel.get_by_answer_id(self.best_answer_id)
loser = AnswerModel.get_by_answer_id(self.other_answer_id)
new_trust = UserModel.newTrust(winner.userID, loser.userID)
UserModel.setTrust(winner.userID,new_trust[0])
UserModel.setTrust(loser.userID,new_trust[1])
示例2: calc_new_trust
# 需要导入模块: from models.user import UserModel [as 别名]
# 或者: from models.user.UserModel import newTrust [as 别名]
def calc_new_trust(self):
print "GET HERE "
winner = AnswerModel.get_by_answer_id(self.best_answer_id)
loser = AnswerModel.get_by_answer_id(self.other_answer_id)
winner_h = UserHistoryModel.get_by_user_id(winner.userID)
loser_h = UserHistoryModel.get_by_user_id(loser.userID)
new_trust = UserModel.newTrust(winner.userID, loser.userID)
#UserHistoryModel(winner.userID, new_trust[0], winner_h.answered, winner_h.asked)
#UserHistoryModel(loser.userID, new_trust[1], loser_h.answered, loser_h.asked)
session.add(UserHistoryModel(winner.userID, new_trust[0], 17, 22))
session.commit()
session.add(UserHistoryModel(loser.userID, new_trust[1], 17, 25))
session.commit()