本文整理匯總了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()