From b8ffda484972fb82b34a454090ddfafdf06f28c1 Mon Sep 17 00:00:00 2001 From: Someone Date: Mon, 8 Mar 2021 22:47:15 +0100 Subject: [PATCH] mattermost_awards/main.py --- mattermost_awards/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mattermost_awards/main.py b/mattermost_awards/main.py index 3f22c01..30abee2 100755 --- a/mattermost_awards/main.py +++ b/mattermost_awards/main.py @@ -47,10 +47,10 @@ def main(): cur.execute(""" UPDATE posts SET props='{"attachments":[{"color":"#38ad69", "text":"User was awarded 1 [Inf-coin](https://mattermost.fsinf.at/fsinf/channels/inf-coin) for this post."}], "infcoin":1}' WHERE (props='' OR props='{}' OR props='{"disable_group_highlight":true}') AND posts.id in (SELECT postid FROM ( - SELECT 'https://mattermost.fsinf.at/'||teams.name||'/pl/'||postid AS url, teams.name||'::'||channels.name AS channelname, count(*) AS cnt, postid, channels.id, posts.userid - FROM reactions JOIN posts ON (postid=posts.id) JOIN channels ON (posts.channelid=channels.id) left JOIN teams ON (teams.id=channels.teamid) - WHERE posts.deleteat = '0' AND channels.type='O' AND channels.id NOT IN ('4rxjday69jbj8pe5pdcx4ezesr') AND channels.id IN ('9twh9scp47g57dgjat61skni5w') AND posts.createat > extract(epoch FROM (NOW() - INTERVAL '1 day'))*1000 - GROUP BY teams.name, channels.name, postid, channels.id, posts.userid + SELECT count(*) AS cnt, postid, channels.id, posts.userid FROM reactions + JOIN posts ON (postid=posts.id) JOIN channels ON (posts.channelid=channels.id) left JOIN teams ON (teams.id=channels.teamid) + WHERE posts.deleteat = '0' AND channels.type='O' AND channels.id NOT IN ('4rxjday69jbj8pe5pdcx4ezesr') AND channels.id IN ('9twh9scp47g57dgjat61skni5w','6ry6x1jg73nsfpggpcudiw65hh') AND posts.createat > extract(epoch FROM (NOW() - INTERVAL '1 day'))*1000 + GROUP BY postid, channels.id, posts.userid ) AS a WHERE cnt >10) RETURNING * """) -- 2.43.0