コード例 #1
0
 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()
     
コード例 #2
0
 def render_by_userid(self, uid):
     return render_template('trustdata.html', data=UserHistoryModel.get_by_user_id_more(uid), data2=UserModel.by_user_id(uid))