zmiany
This commit is contained in:
parent
8989f2abf0
commit
528f31bd2e
15
app.py
15
app.py
@ -40,12 +40,9 @@ def get_users(db_config):
|
|||||||
connection = mysql.connector.connect(**db_config)
|
connection = mysql.connector.connect(**db_config)
|
||||||
cursor = connection.cursor(dictionary=True)
|
cursor = connection.cursor(dictionary=True)
|
||||||
query = """
|
query = """
|
||||||
SELECT u.uid, u.name, u.mail, u.access, u.created, p.points,
|
SELECT u.uid, u.name, u.mail, u.access, u.created, p.points, COUNT(n.nid) AS post_count
|
||||||
COUNT(DISTINCT n.nid) AS post_count,
|
|
||||||
COUNT(DISTINCT c.cid) AS comment_count
|
|
||||||
FROM users u
|
FROM users u
|
||||||
LEFT JOIN node n ON u.uid = n.uid
|
LEFT JOIN node n ON u.uid = n.uid
|
||||||
LEFT JOIN comments c ON u.uid = c.uid
|
|
||||||
LEFT JOIN userpoints p ON u.uid = p.uid
|
LEFT JOIN userpoints p ON u.uid = p.uid
|
||||||
WHERE u.uid > 0
|
WHERE u.uid > 0
|
||||||
GROUP BY u.uid
|
GROUP BY u.uid
|
||||||
@ -232,10 +229,14 @@ def main():
|
|||||||
skipped_veterans = 0
|
skipped_veterans = 0
|
||||||
|
|
||||||
for user in tqdm(users, desc="Analiza"):
|
for user in tqdm(users, desc="Analiza"):
|
||||||
|
if (user.get('points') or 0) > 0:
|
||||||
if (user.get('post_count') or 0) > 0 or (user.get('comment_count') or 0) > 0:
|
skipped_with_points += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if (user.get('post_count') or 0) > 0:
|
||||||
|
# Pomijamy użytkownika, który dodał treści
|
||||||
|
continue
|
||||||
|
|
||||||
# Pomijanie aktywnych "weteranów"
|
# Pomijanie aktywnych "weteranów"
|
||||||
created_year = datetime.datetime.fromtimestamp(user['created']).year if user.get('created') else None
|
created_year = datetime.datetime.fromtimestamp(user['created']).year if user.get('created') else None
|
||||||
recent_login_threshold = now_ts - (args.recent_login_days * 86400)
|
recent_login_threshold = now_ts - (args.recent_login_days * 86400)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user