From d60d07d2057a50cb97e5c51df44502971555acfd Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Wed, 29 May 2024 05:09:56 +0200 Subject: [PATCH 1/4] Exclude archived & deleted reportings from count in prior notification SQL query --- .../repositories/interfaces/DBLogbookReportRepository.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt index 2c699a2cb6..967f6592d7 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt @@ -76,15 +76,18 @@ interface DBLogbookReportRepository : COUNT(r.id) AS reporting_count FROM distinct_cfrs dc LEFT JOIN reportings r ON dc.cfr = r.internal_reference_number + WHERE + r.archived = FALSE + AND r.deleted = FALSE GROUP BY cfr ), dat_and_cor_logbook_reports_with_extra_columns_and_reporting_count AS ( SELECT daclr.*, - cfr_reporting_counts.reporting_count + crc.reporting_count FROM dat_and_cor_logbook_reports_with_extra_columns daclr - LEFT JOIN cfr_reporting_counts ON daclr.cfr = cfr_reporting_counts.cfr + LEFT JOIN cfr_reporting_counts crc ON daclr.cfr = crc.cfr ), dat_and_cor_logbook_reports AS ( From b885943414a270488d0fe4768614dc4646d1997b Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Wed, 29 May 2024 05:17:59 +0200 Subject: [PATCH 2/4] Fix prior notification card width --- .../components/PriorNotificationCard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/features/PriorNotification/components/PriorNotificationCard/index.tsx b/frontend/src/features/PriorNotification/components/PriorNotificationCard/index.tsx index 2585c24151..29785cc536 100644 --- a/frontend/src/features/PriorNotification/components/PriorNotificationCard/index.tsx +++ b/frontend/src/features/PriorNotification/components/PriorNotificationCard/index.tsx @@ -91,7 +91,7 @@ const Card = styled.div` display: flex; flex-direction: column; height: 100%; - width: 544px; + width: 560px; ` const Body = styled.div` From c54588d69f49351da6ed656c46ad000ce157a940 Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Wed, 29 May 2024 05:51:13 +0200 Subject: [PATCH 3/4] Count only infraction reportings in prior notification SQL query --- .../repositories/interfaces/DBLogbookReportRepository.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt index 967f6592d7..933ab30759 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt @@ -77,7 +77,8 @@ interface DBLogbookReportRepository : FROM distinct_cfrs dc LEFT JOIN reportings r ON dc.cfr = r.internal_reference_number WHERE - r.archived = FALSE + r.type = 'INFRACTION_SUSPICION' + AND r.archived = FALSE AND r.deleted = FALSE GROUP BY cfr ), From 66a687f0597b9368913684cdde9e58e259b975d2 Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Wed, 29 May 2024 05:53:23 +0200 Subject: [PATCH 4/4] Coalesce null reporting count values to 0 in prior notification SQL query --- .../repositories/interfaces/DBLogbookReportRepository.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt index 933ab30759..5e8bfbcdcb 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt @@ -86,7 +86,7 @@ interface DBLogbookReportRepository : dat_and_cor_logbook_reports_with_extra_columns_and_reporting_count AS ( SELECT daclr.*, - crc.reporting_count + COALESCE(crc.reporting_count, 0) AS reporting_count FROM dat_and_cor_logbook_reports_with_extra_columns daclr LEFT JOIN cfr_reporting_counts crc ON daclr.cfr = crc.cfr ),