From 5b4d0c1d0ef56d7cb3e586a65ab0da9fe80f38fd Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Fri, 17 Jan 2025 11:42:15 +0100 Subject: [PATCH 1/2] Increase RET search to 3 days --- .../repositories/interfaces/DBLogbookReportRepository.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 51cf1da64a..3ece7eb106 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 @@ -344,8 +344,8 @@ interface DBLogbookReportRepository : SELECT * FROM logbook_reports WHERE referenced_report_id IN (select report_id FROM dat_cor) - AND operation_datetime_utc >= cast(:startDate AS TIMESTAMP) - INTERVAL '1 day' - AND operation_datetime_utc <= cast(:endDate AS TIMESTAMP) + INTERVAL '1 day' + AND operation_datetime_utc >= cast(:startDate AS TIMESTAMP) - INTERVAL '3 days' + AND operation_datetime_utc <= cast(:endDate AS TIMESTAMP) + INTERVAL '3 days' AND operation_type = 'RET' AND NOT is_test_message ) @@ -383,8 +383,8 @@ interface DBLogbookReportRepository : FROM logbook_reports WHERE referenced_report_id IN (select report_id FROM dat_cor) AND - operation_datetime_utc >= cast(?2 AS timestamp) - INTERVAL '1 day' AND - operation_datetime_utc < cast(?3 AS timestamp) + INTERVAL '1 day' AND + operation_datetime_utc >= cast(?2 AS timestamp) - INTERVAL '3 days' AND + operation_datetime_utc < cast(?3 AS timestamp) + INTERVAL '3 days' AND operation_type = 'RET' AND NOT is_test_message ORDER BY operation_datetime_utc DESC From bf396f1f3ce90dfa69a72b5bae88e2021d9a3ab6 Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Mon, 20 Jan 2025 09:05:50 +0100 Subject: [PATCH 2/2] Refactor to only 1 day in the past --- .../repositories/interfaces/DBLogbookReportRepository.kt | 4 ++-- 1 file changed, 2 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 3ece7eb106..ea4e32a69a 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 @@ -344,7 +344,7 @@ interface DBLogbookReportRepository : SELECT * FROM logbook_reports WHERE referenced_report_id IN (select report_id FROM dat_cor) - AND operation_datetime_utc >= cast(:startDate AS TIMESTAMP) - INTERVAL '3 days' + AND operation_datetime_utc >= cast(:startDate AS TIMESTAMP) - INTERVAL '1 day' AND operation_datetime_utc <= cast(:endDate AS TIMESTAMP) + INTERVAL '3 days' AND operation_type = 'RET' AND NOT is_test_message @@ -383,7 +383,7 @@ interface DBLogbookReportRepository : FROM logbook_reports WHERE referenced_report_id IN (select report_id FROM dat_cor) AND - operation_datetime_utc >= cast(?2 AS timestamp) - INTERVAL '3 days' AND + operation_datetime_utc >= cast(?2 AS timestamp) - INTERVAL '1 day' AND operation_datetime_utc < cast(?3 AS timestamp) + INTERVAL '3 days' AND operation_type = 'RET' AND NOT is_test_message