From: Magnus Hagander Date: Mon, 22 Sep 2025 21:45:57 +0000 (+0200) Subject: Include pronouns in json report X-Git-Url: http://git.postgresql.org/gitweb/delmail?a=commitdiff_plain;h=46a78d77f25bd07c35366289e99b640ec6297c9c;p=pgeu-system.git Include pronouns in json report This is needed so they can be shown on a badge when doing trial printing. Reported by Jimmy Angelakos --- diff --git a/postgresqleu/confreg/migrations/0120_pronounstext.py b/postgresqleu/confreg/migrations/0120_pronounstext.py new file mode 100644 index 00000000..c0efcdc3 --- /dev/null +++ b/postgresqleu/confreg/migrations/0120_pronounstext.py @@ -0,0 +1,27 @@ +# Generated by Django 4.2.11 on 2025-09-22 21:36 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('confreg', '0119_conferenceadditionaloption_requires_attendee'), + ] + + operations = [ + migrations.RunSQL( + "CREATE TABLE IF NOT EXISTS pronouns_text(id int not null primary key, pronountext text not null)", + "DROP TABLE pronouns_text", + ), + migrations.RunSQL( + """WITH t(id, pronountext) AS (VALUES + (0, ''), + (1, 'she/her'), + (2, 'he/him'), + (3, 'they/them'), + (4, 'other') + ) MERGE INTO pronouns_text p USING t ON t.id=p.id WHEN MATCHED AND t.pronountext != p.pronountext THEN UPDATE SET pronountext=t.pronountext WHEN NOT MATCHED THEN INSERT (id, pronountext) VALUES (t.id, t.pronountext)""", + "DELETE FROM pronouns_text", + ) + ] diff --git a/postgresqleu/confreg/reports.py b/postgresqleu/confreg/reports.py index 15fd427d..ad836ba7 100644 --- a/postgresqleu/confreg/reports.py +++ b/postgresqleu/confreg/reports.py @@ -584,11 +584,12 @@ class AttendeeReportManager: 'confreg_conferenceregistration_additionaloptions': 'crao', 'confreg_conferenceadditionaloption': 'ao', 'confreg_shirtsize': 's', + 'pronouns_text': 'pt', }.get(table, table), _f) query = """SELECT r.id, firstname, lastname, email, company, address, phone, dietary, twittername, nick, badgescan, shareemail, vouchercode, country.name AS countryname, country.printable_name AS country, - s.shirtsize, + s.shirtsize, CASE WHEN conference.askpronouns THEN pt.pronountext ELSE '' END AS pronounstext, '{}/t/id/' || idtoken || '/' AS fullidtoken, '{}/t/at/' || publictoken || '/' AS fullpublictoken, regexp_replace(upper(substring(CASE WHEN conference.queuepartitioning=1 THEN lastname WHEN conference.queuepartitioning=2 THEN firstname END, 1, 1)), '[^A-Z]', 'Other') AS queuepartition, @@ -608,8 +609,9 @@ LEFT JOIN confreg_conferenceregistration_additionaloptions crao ON crao.conferen LEFT JOIN confreg_conferenceadditionaloption ao ON crao.conferenceadditionaloption_id=ao.id LEFT JOIN country ON country.iso=r.country_id LEFT JOIN confreg_shirtsize s ON s.id=r.shirtsize_id +LEFT JOIN pronouns_text pt ON pt.id=r.pronouns WHERE r.conference_id=%(conference_id)s {} -GROUP BY r.id, conference.id, rt.id, rc.id, country.iso, s.id +GROUP BY r.id, conference.id, rt.id, rc.id, country.iso, s.id, pt.id ORDER BY {}""".format(settings.SITEBASE, settings.SITEBASE, where, ", ".join([_get_table_aliased_field(o.get_orderby_field()) for o in ofields])) with ensure_conference_timezone(self.conference):