limit user list to current round players
This commit is contained in:
@@ -129,15 +129,21 @@ class WordleDb:
|
|||||||
|
|
||||||
def get_users_without_score(self, round_no, hole_no, tweetable=True):
|
def get_users_without_score(self, round_no, hole_no, tweetable=True):
|
||||||
hole = self.get_or_create_hole(round_no, hole_no)
|
hole = self.get_or_create_hole(round_no, hole_no)
|
||||||
|
# Find users who *have* played in this round,
|
||||||
|
# but have no score on the current hole
|
||||||
query_str = """SELECT username
|
query_str = """SELECT username
|
||||||
FROM user_tbl u
|
FROM user_tbl u
|
||||||
WHERE NOT EXISTS (
|
WHERE NOT EXISTS (
|
||||||
SELECT FROM score WHERE score.user_id = u.user_id AND score.hole_id = {}
|
SELECT FROM score WHERE score.user_id = u.user_id AND score.hole_id = {}
|
||||||
)""".format(
|
) AND EXISTS (
|
||||||
hole.hole_id
|
SELECT FROM score WHERE score.user_id = u.user_id AND score.game_id = {}
|
||||||
|
)
|
||||||
|
""".format(
|
||||||
|
hole.hole_id, hole.game_id
|
||||||
)
|
)
|
||||||
|
|
||||||
if tweetable:
|
if tweetable:
|
||||||
|
# Restrict to users who post scores on twitter
|
||||||
query_str += " AND u.check_twitter = true"
|
query_str += " AND u.check_twitter = true"
|
||||||
|
|
||||||
res = db.execute_sql(query_str)
|
res = db.execute_sql(query_str)
|
||||||
|
|||||||
Reference in New Issue
Block a user