コード例 #1
0
ファイル: count_votes.py プロジェクト: saviaga/PlayWithMe
def count_correct_answer(id,the_bot):

    print("id: ",id)

    points = VerifiedAnswers.select(VerifiedAnswers.answer,VerifiedAnswers.verfied_short_id).where(VerifiedAnswers.verfied_short_id == id )
    tweetspositive = points.where((VerifiedAnswers.verfied_short_id ==  id ) & (VerifiedAnswers.answer == 'y') )
    #from verifiedanswer table check the number of Y answer for each id
    answer_points = (tweetspositive.count())
    #returns the points per answer
    return answer_points
コード例 #2
0
ファイル: count_votes.py プロジェクト: saviaga/PlayWithMe
def get_id_shortid():
    unique_ids=[]
    #from the verifiedanswers table make a select distinct to filters ids of users without repeating ids

    ids = VerifiedAnswers.select(VerifiedAnswers.verfied_short_id).distinct()

    for u in ids:
        try:
            unique_ids.append(u.verfied_short_id.short_tweet_id)
        #in case that the user gave a short id that does not correspond to a tweet id then just ignore it
        except:
            pass
    return unique_ids