File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Feature.Form.Submissions/ListEntries
Vote.Monitor.Hangfire/Jobs/Export/FormSubmissions Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -186,9 +186,11 @@ form_submissions AS (SELECT fs."Id"
186186 fs."NumberOfFlaggedAnswers",
187187 (SELECT COUNT(1)
188188 FROM "Attachments" A
189- WHERE A."FormId" = fs."FormId"
190- AND a."MonitoringObserverId" = fs."MonitoringObserverId"
191- AND fs."PollingStationId" = A."PollingStationId"
189+ WHERE a."MonitoringObserverId" = FS."MonitoringObserverId"
190+ AND (
191+ (A."FormId" = FS."FormId" AND FS."PollingStationId" = A."PollingStationId") -- backwards compatibility
192+ OR A."SubmissionId" = FS."Id"
193+ )
192194 AND A."IsDeleted" = false
193195 AND A."IsCompleted" = true) AS "MediaFilesCount",
194196 (SELECT COUNT(1)
Original file line number Diff line number Diff line change @@ -228,9 +228,10 @@ ORDER BY
228228 "Attachments" A
229229 WHERE
230230 A."ElectionRoundId" = @ELECTIONROUNDID
231- AND A."FormId" = FS."FormId"
232- AND A."MonitoringObserverId" = FS."MonitoringObserverId"
233- AND FS."PollingStationId" = A."PollingStationId"
231+ AND (
232+ (A."FormId" = FS."FormId" AND FS."PollingStationId" = A."PollingStationId") -- backwards compatibility
233+ OR A."SubmissionId" = FS."Id"
234+ )
234235 ),
235236 '[]'::JSONB
236237 ) AS "Attachments",
You can’t perform that action at this time.
0 commit comments