From a5d9c6b84070a8a2d7f6d65347a4cdd8975ffa3b Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Tue, 8 Oct 2024 22:23:12 +0200
Subject: [PATCH] =?UTF-8?q?Skript=20pro=20v=C3=BDb=C4=9Br=20adres=20k=20ro?=
 =?UTF-8?q?zesl=C3=A1n=C3=AD=20reklamy=20na=20MO-P?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/p-spam-abc | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100755 bin/p-spam-abc

diff --git a/bin/p-spam-abc b/bin/p-spam-abc
new file mode 100755
index 00000000..b6416b24
--- /dev/null
+++ b/bin/p-spam-abc
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Najde adresy účastníků kategorií A-C, kterým chceme poslat spam o MO-P
+
+YEAR=73
+
+psql mo_osmo -q --csv -c "
+	select email from users
+	where user_id in (
+		select user_id from participants
+		where year=$YEAR
+		and grade not in ('8/8', '4/4')
+	) and user_id in (
+		select user_id from participations
+		where contest_id in (
+			select contest_id from contests
+			where round_id in (
+				select round_id from rounds
+				where year=$YEAR
+				and category in ('A', 'B', 'C')
+				and seq=1
+			)
+		)
+	) and email not like '%@nomail'
+	and email not like '%@test'
+	order by email;
+"
-- 
GitLab