當前位置: 首頁>>代碼示例>>Python>>正文


Python UserModel.newTrust方法代碼示例

本文整理匯總了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])
     
開發者ID:klaplong,項目名稱:SWE_2013_Groep2,代碼行數:8,代碼來源:answerchoice.py

示例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()
     
開發者ID:koenk,項目名稱:software-engineering-team6,代碼行數:15,代碼來源:answerchoice.py


注:本文中的models.user.UserModel.newTrust方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。