From 32be1a4235bedbdeb2a9efcf82212807bd172a21 Mon Sep 17 00:00:00 2001 From: Payten Giles Date: Fri, 2 Apr 2021 09:40:14 +1100 Subject: [PATCH] Support MySQL 8.x as well as my ancient version of MariaDB --- backend/model/spreadsheet_builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/model/spreadsheet_builder.rb b/backend/model/spreadsheet_builder.rb index 5dee0a7..30fc046 100644 --- a/backend/model/spreadsheet_builder.rb +++ b/backend/model/spreadsheet_builder.rb @@ -131,7 +131,7 @@ def calculate_max_subrecords .filter(:archival_object_id => @ao_ids) .filter(Sequel.like(:notes, '%"type":"'+note_type.to_s+'"%')) .group(:archival_object_id) - .select(Sequel.lit("CAST(SUM(CAST(((LENGTH(`notes`) - LENGTH(REPLACE(`notes`, '#{text_string}', ''))) / #{text_string.length}) AS int)) AS int) AS count")) + .select(Sequel.lit("CAST(SUM(CAST(((LENGTH(`notes`) - LENGTH(REPLACE(`notes`, '#{text_string}', ''))) / #{text_string.length}) AS SIGNED)) AS SIGNED) AS count")) .from_self .select(Sequel.lit("MAX(count) AS max"))