From d62ef20271ac52a1d1cb7a64b48a2ea9c4ad1684 Mon Sep 17 00:00:00 2001 From: Christian Boltz <github-helios-server@cboltz.de> Date: Sun, 14 Nov 2021 20:45:33 +0100 Subject: [PATCH] Use substr() instead of substring() in SQL query SQLite doesn't know substring() - only substr() works. In MySQL, MariaDB and PostgreSQL), substring() and substr() do the same. --- helios/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helios/models.py b/helios/models.py index 551c4ae..d8faa77 100644 --- a/helios/models.py +++ b/helios/models.py @@ -183,7 +183,7 @@ class Election(HeliosModel): if not self.use_voter_aliases: return None - return utils.one_val_raw_sql("select max(cast(substring(alias, 2) as integer)) from " + Voter._meta.db_table + " where election_id = %s", [self.id]) or 0 + return utils.one_val_raw_sql("select max(cast(substr(alias, 2) as integer)) from " + Voter._meta.db_table + " where election_id = %s", [self.id]) or 0 @property def encrypted_tally_hash(self): -- GitLab