def question_upvotes_milestone_notifications(): result = db.session.execute(text('''SELECT distinct pl.question as question, questions.question_author from question_upvotes pl inner join questions on questions.id = pl.question where pl.timestamp >= date_sub(now(), interval 1 day) group by pl.question union SELECT distinct pl.question as question, questions.question_author from inflated_stats pl inner join questions on questions.id = pl.question where pl.timestamp >= date_sub(now(), interval 1 day) group by pl.question; ''')) for row in result: check_and_make_milestone('post_likes', row[1], row[0], util.get_post_like_count(row[0]))
def decide_post_milestone(post_id, user_id): check_and_make_milestone('post-likes-milestone', user_id, post_id, util.get_post_like_count(post_id))