From 7c57185a84965b3ffeddc080256243d1bea808c3 Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Thu, 31 Oct 2024 12:13:07 +0100 Subject: [PATCH 1/4] Fix updated at --- .../CreateOrUpdateManualPriorNotification.kt | 10 +++--- .../entities/ManualPriorNotificationEntity.kt | 16 ++-------- .../JpaManualPriorNotificationRepository.kt | 2 +- ...Update_manual_prior_notification_table.sql | 2 ++ ...nsert_dummy_manual_prior_notifications.sql | 32 ++++++++++++------- ...ert_dummy_manual_prior_notifications.jsonc | 22 ++++++------- ...ManualPriorNotificationRepositoryITests.kt | 1 + .../src/features/Logbook/Logbook.types.ts | 6 ---- 8 files changed, 44 insertions(+), 47 deletions(-) create mode 100644 backend/src/main/resources/db/migration/internal/V0.281__Update_manual_prior_notification_table.sql diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt index db0c41ca6f..fcb635a9a1 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt @@ -49,11 +49,11 @@ class CreateOrUpdateManualPriorNotification( tripGearCodes: List, vesselId: Int, ): PriorNotification { - val existingMessageValue: PNO? = + val existingManualPriorNotification = reportId?.let { - val manualPriorNotfication = manualPriorNotificationRepository.findByReportId(reportId) - manualPriorNotfication?.logbookMessageAndValue?.logbookMessage?.message as PNO + manualPriorNotificationRepository.findByReportId(reportId) } + val existingMessageValue: PNO? = existingManualPriorNotification?.logbookMessageAndValue?.logbookMessage?.message as PNO? // /!\ Backend computed vessel risk factor is only used as a real time Frontend indicator. // The Backend should NEVER update `risk_factors` DB table, only the pipeline is allowed to update it. @@ -138,8 +138,8 @@ class CreateOrUpdateManualPriorNotification( isManuallyCreated = true, logbookMessageAndValue = logbookMessageAndValue, sentAt = sentAt, + createdAt = existingManualPriorNotification?.createdAt, // All these props are useless for the save operation. - createdAt = null, port = null, reportingCount = null, seafront = null, @@ -198,6 +198,7 @@ class CreateOrUpdateManualPriorNotification( val isBeingSent = !isInVerificationScope && isPartOfControlUnitSubscriptions val portName = allPorts.find { it.locode == portLocode }?.name val updatedBy = if (existingMessageValue != null) author else null + val updatedAt = if (existingMessageValue != null) ZonedDateTime.now() else null return PNO().apply { this.authorTrigram = authorTrigram @@ -231,6 +232,7 @@ class CreateOrUpdateManualPriorNotification( this.tripStartDate = null this.riskFactor = computedVesselRiskFactor this.updatedBy = updatedBy + this.updatedAt = updatedAt } } diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/ManualPriorNotificationEntity.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/ManualPriorNotificationEntity.kt index 72ed5457bf..9ae04fdc38 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/ManualPriorNotificationEntity.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/ManualPriorNotificationEntity.kt @@ -40,8 +40,6 @@ data class ManualPriorNotificationEntity( @Column(name = "trip_segments", nullable = true, columnDefinition = "jsonb") @Type(JsonBinaryType::class) val tripSegments: List?, - @Column(name = "updated_at") - val updatedAt: ZonedDateTime, @Column(name = "value", nullable = true, columnDefinition = "jsonb") @Type(JsonBinaryType::class) val value: PNO, @@ -49,20 +47,11 @@ data class ManualPriorNotificationEntity( val vesselName: String?, ) { companion object { - fun fromPriorNotification( - priorNotification: PriorNotification, - isUpdate: Boolean = false, - ): ManualPriorNotificationEntity { + fun fromPriorNotification(priorNotification: PriorNotification): ManualPriorNotificationEntity { try { val pnoLogbookMessage = priorNotification.logbookMessageAndValue.logbookMessage val pnoLogbookMessageValue = priorNotification.logbookMessageAndValue.value val createdAt = priorNotification.createdAt ?: ZonedDateTime.now() - val updatedAt = - if (isUpdate || priorNotification.updatedAt == null) { - ZonedDateTime.now() - } else { - priorNotification.updatedAt - } val sentAt = requireNotNull(priorNotification.sentAt) { "`sentAt` is null." } val vesselId = requireNotNull(pnoLogbookMessage.vesselId) { "`vesselId` is null." } @@ -78,7 +67,6 @@ data class ManualPriorNotificationEntity( sentAt = sentAt, tripGears = pnoLogbookMessage.tripGears, tripSegments = pnoLogbookMessage.tripSegments, - updatedAt = updatedAt, value = pnoLogbookMessageValue, vesselName = pnoLogbookMessage.vesselName, vesselId = vesselId, @@ -129,7 +117,7 @@ data class ManualPriorNotificationEntity( logbookMessageAndValue = logbookMessageAndValue, reportId = reportId, sentAt = sentAt, - updatedAt = updatedAt, + updatedAt = logbookMessageAndValue.value.updatedAt, // These props need to be calculated in the use case port = null, reportingCount = null, diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt index d910f08151..14624ffeac 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt @@ -77,7 +77,7 @@ class JpaManualPriorNotificationRepository( try { val manualPriorNotificationEntity = dbManualPriorNotificationRepository - .save(ManualPriorNotificationEntity.fromPriorNotification(newOrNextPriorNotification, true)) + .save(ManualPriorNotificationEntity.fromPriorNotification(newOrNextPriorNotification)) return manualPriorNotificationEntity.toPriorNotification() } catch (e: IllegalArgumentException) { diff --git a/backend/src/main/resources/db/migration/internal/V0.281__Update_manual_prior_notification_table.sql b/backend/src/main/resources/db/migration/internal/V0.281__Update_manual_prior_notification_table.sql new file mode 100644 index 0000000000..27cf6f5abf --- /dev/null +++ b/backend/src/main/resources/db/migration/internal/V0.281__Update_manual_prior_notification_table.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.manual_prior_notifications + DROP COLUMN updated_at; diff --git a/backend/src/main/resources/db/testdata/V666.5.2__Insert_dummy_manual_prior_notifications.sql b/backend/src/main/resources/db/testdata/V666.5.2__Insert_dummy_manual_prior_notifications.sql index 580f1a15b1..78beff0b78 100644 --- a/backend/src/main/resources/db/testdata/V666.5.2__Insert_dummy_manual_prior_notifications.sql +++ b/backend/src/main/resources/db/testdata/V666.5.2__Insert_dummy_manual_prior_notifications.sql @@ -1,54 +1,64 @@ -- /!\ This file is automatically generated by a local script. -- Do NOT update it directly, update the associated .jsonc file in /backend/src/main/resources/db/testdata/json/ and execute 'make generate-test-data'. -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000001', 'CFR112', 112, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"LNP"}]', '[{"segment":"NWW09","segmentName":"Lignes"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes', 'POISSON PAS NET', '{"authorTrigram":"BOB","createdBy":null,"riskFactor":2.1,"catchOnboard":[{"faoZone":"21.1.A","weight":72,"nbFish":null,"species":"SOS"}],"catchToLand":[{"faoZone":"21.1.A","weight":72,"nbFish":null,"species":"SOS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRVNE","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000001', 'CFR112', 112, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"LNP"}]', '[{"segment":"NWW09","segmentName":"Lignes"}]', 'POISSON PAS NET', '{"updatedAt":null,"authorTrigram":"BOB","createdBy":null,"riskFactor":2.1,"catchOnboard":[{"faoZone":"21.1.A","weight":72,"nbFish":null,"species":"SOS"}],"catchToLand":[{"faoZone":"21.1.A","weight":72,"nbFish":null,"species":"SOS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRVNE","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000001'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000001'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000001'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000001'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000002', 'CFR115', 115, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'BEL', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"TB"},{"gear":"TBS"}]', '[{"segment":"NWW03","segmentName":"Chalut de fond en eau profonde"},{"segment":"NWW05","segmentName":"Chalut à perche"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes', 'DOS FIN', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":2.7,"catchOnboard":[{"faoZone":"21.1.B","weight":300,"nbFish":10,"species":"BF1"},{"faoZone":"21.1.B","weight":100,"nbFish":20,"species":"BF3"},{"faoZone":"21.1.B","weight":400,"nbFish":80,"species":"SWO"},{"faoZone":"21.1.B","weight":600,"nbFish":null,"species":"BFT"},{"faoZone":"21.1.B","weight":200,"nbFish":25,"species":"BF2"}],"catchToLand":[{"faoZone":"21.1.B","weight":600,"nbFish":null,"species":"BFT"},{"faoZone":"21.1.B","weight":300,"nbFish":10,"species":"BF1"},{"faoZone":"21.1.B","weight":200,"nbFish":25,"species":"BF2"},{"faoZone":"21.1.B","weight":100,"nbFish":20,"species":"BF3"},{"faoZone":"21.1.B","weight":400,"nbFish":80,"species":"SWO"}],"faoZone":null,"isBeingSent":true,"isInVerificationScope":false,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type B","minimumNotificationPeriod":4,"hasDesignatedPorts":false},{"pnoTypeName":"Préavis type C","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRVNE","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":"editor@example.org"}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000002', 'CFR115', 115, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'BEL', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"TB"},{"gear":"TBS"}]', '[{"segment":"NWW03","segmentName":"Chalut de fond en eau profonde"},{"segment":"NWW05","segmentName":"Chalut à perche"}]', 'DOS FIN', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":2.7,"catchOnboard":[{"faoZone":"21.1.B","weight":300,"nbFish":10,"species":"BF1"},{"faoZone":"21.1.B","weight":100,"nbFish":20,"species":"BF3"},{"faoZone":"21.1.B","weight":400,"nbFish":80,"species":"SWO"},{"faoZone":"21.1.B","weight":600,"nbFish":null,"species":"BFT"},{"faoZone":"21.1.B","weight":200,"nbFish":25,"species":"BF2"}],"catchToLand":[{"faoZone":"21.1.B","weight":600,"nbFish":null,"species":"BFT"},{"faoZone":"21.1.B","weight":300,"nbFish":10,"species":"BF1"},{"faoZone":"21.1.B","weight":200,"nbFish":25,"species":"BF2"},{"faoZone":"21.1.B","weight":100,"nbFish":20,"species":"BF3"},{"faoZone":"21.1.B","weight":400,"nbFish":80,"species":"SWO"}],"faoZone":null,"isBeingSent":true,"isInVerificationScope":false,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type B","minimumNotificationPeriod":4,"hasDesignatedPorts":false},{"pnoTypeName":"Préavis type C","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRVNE","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":"editor@example.org"}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000002'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000002'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '4 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000002'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000002'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000003', 'CFR117', 117, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', true, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"TBS"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"},{"segment":"MED02","segmentName":"All Trawls 2"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'QUEUE DE POISSON', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.1,"catchOnboard":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"BIB"}],"catchToLand":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"BIB"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":true,"isVerified":false,"note":"Pêche abandonnée pour cause de météo défavorable.","pnoTypes":[{"pnoTypeName":"Préavis type E","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000003', 'CFR117', 117, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', true, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"TBS"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"},{"segment":"MED02","segmentName":"All Trawls 2"}]', 'QUEUE DE POISSON', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.1,"catchOnboard":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"BIB"}],"catchToLand":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"BIB"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":true,"isVerified":false,"note":"Pêche abandonnée pour cause de météo défavorable.","pnoTypes":[{"pnoTypeName":"Préavis type E","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000003'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000003'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000003'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000003'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000004', 'CFR116', 116, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'NAVIRE RENOMMÉ (ANCIEN NOM)', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":1.5,"catchOnboard":[{"faoZone":"21.1.C","weight":24.3,"nbFish":null,"species":"ALV"}],"catchToLand":[{"faoZone":"21.1.C","weight":24.3,"nbFish":null,"species":"ALV"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isInvalidated":true,"isSent":false,"isVerified":true,"note":0,"pnoTypes":[{"pnoTypeName":"Préavis type C","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000004', 'CFR116', 116, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'NAVIRE RENOMMÉ (ANCIEN NOM)', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":1.5,"catchOnboard":[{"faoZone":"21.1.C","weight":24.3,"nbFish":null,"species":"ALV"}],"catchToLand":[{"faoZone":"21.1.C","weight":24.3,"nbFish":null,"species":"ALV"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isInvalidated":true,"isSent":false,"isVerified":true,"note":0,"pnoTypes":[{"pnoTypeName":"Préavis type C","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000004'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000004'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000004'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000004'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000005', 'CFR120', 120, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'ITA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'VIVA L''ITALIA', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":true,"isInVerificationScope":false,"isSent":false,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type C","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000005', 'CFR120', 120, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'ITA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'VIVA L''ITALIA', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":0,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":true,"isInVerificationScope":false,"isSent":false,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type C","minimumNotificationPeriod":8,"hasDesignatedPorts":true}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000005'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000005'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000005'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000005'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000006', 'CFR121', 121, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'MARE ET BASS', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":true,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000006', 'CFR121', 121, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'MARE ET BASS', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":true,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000006'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000006'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000006'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000006'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000007', 'CFR122', 122, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'FILET DOUX', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":true,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000007', 'CFR122', 122, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'FILET DOUX', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":true,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000007'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000007'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000007'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000007'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000008', 'CFR123', 123, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'DÉVOILÉ', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":true,"isSent":false,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000008', 'CFR123', 123, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'DÉVOILÉ', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":true,"isSent":false,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000008'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000008'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000008'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000008'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000009', 'CFR124', 124, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'MAT QUILLE', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":true,"isInVerificationScope":true,"isSent":false,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000009', 'CFR124', 124, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'MAT QUILLE', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":true,"isInVerificationScope":true,"isSent":false,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000009'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000009'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000009'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000009'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000010', 'CFR125', 125, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'BEAU SÉANT', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":true,"isSent":true,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000010', 'CFR125', 125, NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', false, 'FRA', NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes', '[{"gear":"OTT"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'BEAU SÉANT', '{"updatedAt":null,"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.2,"catchOnboard":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"catchToLand":[{"faoZone":"21.1.C","weight":50,"nbFish":null,"species":"AGS"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":true,"isSent":true,"isVerified":true,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type A","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRMRS","predictedArrivalDatetimeUtc":null,"predictedLandingDatetimeUtc":null,"purpose":"LAN","tripStartDate":null,"updatedBy":null}'); +UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{updatedAt}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000010'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedArrivalDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000010'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{predictedLandingDatetimeUtc}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' + INTERVAL '3.5 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000010'; UPDATE manual_prior_notifications SET value = JSONB_SET(value, '{tripStartDate}', TO_JSONB(TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 hours', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')), true) WHERE report_id = '00000000-0000-4000-0000-000000000010'; -INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, updated_at, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000011', 'CFR118', 118, '2023-01-01T08:45:00', true, 'FRA', '2023-01-01T08:30:00', '[{"gear":"OTB"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', '2023-01-01T08:45:00', 'GOUJON BOUGON', '{"authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.8,"catchOnboard":[{"faoZone":"21.1.C","weight":10,"nbFish":null,"species":"BIB"}],"catchToLand":[{"faoZone":"21.1.C","weight":10,"nbFish":null,"species":"BIB"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type F","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRNCE","predictedArrivalDatetimeUtc":"2023-01-01T10:00:00Z","predictedLandingDatetimeUtc":"2023-01-01T10:30:00Z","purpose":"LAN","tripStartDate":"2023-01-01T08:00:00Z","updatedBy":null}'); +INSERT INTO manual_prior_notifications (report_id, cfr, vessel_id, created_at, did_not_fish_after_zero_notice, flag_state, sent_at, trip_gears, trip_segments, vessel_name, value) VALUES ('00000000-0000-4000-0000-000000000011', 'CFR118', 118, '2023-01-01T08:45:00', true, 'FRA', '2023-01-01T08:30:00', '[{"gear":"OTB"}]', '[{"segment":"MED01","segmentName":"All Trawls 1"}]', 'GOUJON BOUGON', '{"updatedAt":"2023-01-01T08:45:00Z","authorTrigram":null,"createdBy":"creator@example.org","riskFactor":3.8,"catchOnboard":[{"faoZone":"21.1.C","weight":10,"nbFish":null,"species":"BIB"}],"catchToLand":[{"faoZone":"21.1.C","weight":10,"nbFish":null,"species":"BIB"}],"faoZone":null,"isBeingSent":false,"isInVerificationScope":false,"isSent":false,"isVerified":false,"note":null,"pnoTypes":[{"pnoTypeName":"Préavis type F","minimumNotificationPeriod":4,"hasDesignatedPorts":false}],"port":"FRNCE","predictedArrivalDatetimeUtc":"2023-01-01T10:00:00Z","predictedLandingDatetimeUtc":"2023-01-01T10:30:00Z","purpose":"LAN","tripStartDate":"2023-01-01T08:00:00Z","updatedBy":null}'); diff --git a/backend/src/main/resources/db/testdata/json/V666.5.2__Insert_dummy_manual_prior_notifications.jsonc b/backend/src/main/resources/db/testdata/json/V666.5.2__Insert_dummy_manual_prior_notifications.jsonc index 18fb41fdd8..77dddcf062 100644 --- a/backend/src/main/resources/db/testdata/json/V666.5.2__Insert_dummy_manual_prior_notifications.jsonc +++ b/backend/src/main/resources/db/testdata/json/V666.5.2__Insert_dummy_manual_prior_notifications.jsonc @@ -21,9 +21,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "LNP" }], "trip_segments:jsonb": [{ "segment": "NWW09", "segmentName": "Lignes" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes'", "vessel_name": "POISSON PAS NET", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": "BOB", "createdBy": null, "riskFactor": 2.1, @@ -86,9 +86,9 @@ { "segment": "NWW03", "segmentName": "Chalut de fond en eau profonde" }, { "segment": "NWW05", "segmentName": "Chalut à perche" } ], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes'", "vessel_name": "DOS FIN", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '10 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 2.7, @@ -204,9 +204,9 @@ { "segment": "MED01", "segmentName": "All Trawls 1" }, { "segment": "MED02", "segmentName": "All Trawls 2" } ], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "QUEUE DE POISSON", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.1, @@ -261,9 +261,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "OTT" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "NAVIRE RENOMMÉ (ANCIEN NOM)", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 1.5, @@ -321,9 +321,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "OTT" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "VIVA L'ITALIA", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.2, @@ -377,9 +377,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "OTT" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "MARE ET BASS", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.2, @@ -433,9 +433,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "OTT" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "FILET DOUX", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.2, @@ -489,9 +489,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "OTT" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "DÉVOILÉ", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.2, @@ -545,9 +545,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "OTT" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "MAT QUILLE", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.2, @@ -601,9 +601,9 @@ "sent_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '30 minutes'", "trip_gears:jsonb": [{ "gear": "OTT" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at:sql": "NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes'", "vessel_name": "BEAU SÉANT", "value:jsonb": { + "updatedAt:sql": "TO_CHAR(NOW() AT TIME ZONE 'UTC' - INTERVAL '15 minutes', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.2, @@ -661,9 +661,9 @@ "sent_at": "2023-01-01T08:30:00", "trip_gears:jsonb": [{ "gear": "OTB" }], "trip_segments:jsonb": [{ "segment": "MED01", "segmentName": "All Trawls 1" }], - "updated_at": "2023-01-01T08:45:00", "vessel_name": "GOUJON BOUGON", "value:jsonb": { + "updatedAt": "2023-01-01T08:45:00Z", "authorTrigram": null, "createdBy": "creator@example.org", "riskFactor": 3.8, diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepositoryITests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepositoryITests.kt index 236d046ec9..ddc96bea6a 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepositoryITests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepositoryITests.kt @@ -503,6 +503,7 @@ class JpaManualPriorNotificationRepositoryITests : AbstractDBTests() { catchToLand = emptyList() economicZone = null effortZone = null + createdBy = "ABC" faoZone = null latitude = null longitude = null diff --git a/frontend/src/features/Logbook/Logbook.types.ts b/frontend/src/features/Logbook/Logbook.types.ts index 597cce1751..6f0af05940 100644 --- a/frontend/src/features/Logbook/Logbook.types.ts +++ b/frontend/src/features/Logbook/Logbook.types.ts @@ -196,12 +196,6 @@ export namespace Logbook { riskFactor: number | undefined statisticalRectangle: string | undefined tripStartDate: string | undefined - /** - * @internal - * This `updatedAt` field is only used internally for logbook PNOs. It's always `undefined` for manual ones. - * - * /!\ Use `PriorNotification.PriorNotification.updatedAt` or `PriorNotification.Detail.updatedAt` instead. - */ updatedAt: string | undefined updatedBy: string | undefined } From bd6f1006c30344d29a93ab35ac614cd10b77b373 Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Mon, 4 Nov 2024 11:35:37 +0100 Subject: [PATCH 2/4] Fix last update by field --- .../CreateOrUpdateManualPriorNotification.kt | 8 +-- frontend/cypress/e2e/utils/isDateCloseTo.ts | 2 +- .../EditHistory/__tests__/utils.test.ts | 64 +++++++++++++++++++ .../components/shared/EditHistory/utils.ts | 15 ++++- 4 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 frontend/src/features/PriorNotification/components/shared/EditHistory/__tests__/utils.test.ts diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt index fcb635a9a1..1132cd8ab7 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt @@ -189,7 +189,7 @@ class CreateOrUpdateManualPriorNotification( val allPorts = portRepository.findAll() val authorTrigram = existingMessageValue?.authorTrigram - val createdBy = existingMessageValue?.createdBy ?: author + val createdBy = existingMessageValue?.createdBy ?: existingMessageValue?.authorTrigram ?: author val isInVerificationScope = ManualPriorNotificationComputedValues .isInVerificationScope(computedVesselFlagCountryCode, computedVesselRiskFactor) @@ -197,8 +197,6 @@ class CreateOrUpdateManualPriorNotification( // we pass `isBeingSent` as `true` in order to ask the workflow to send it. val isBeingSent = !isInVerificationScope && isPartOfControlUnitSubscriptions val portName = allPorts.find { it.locode == portLocode }?.name - val updatedBy = if (existingMessageValue != null) author else null - val updatedAt = if (existingMessageValue != null) ZonedDateTime.now() else null return PNO().apply { this.authorTrigram = authorTrigram @@ -231,8 +229,8 @@ class CreateOrUpdateManualPriorNotification( this.statisticalRectangle = null this.tripStartDate = null this.riskFactor = computedVesselRiskFactor - this.updatedBy = updatedBy - this.updatedAt = updatedAt + this.updatedBy = author + this.updatedAt = ZonedDateTime.now() } } diff --git a/frontend/cypress/e2e/utils/isDateCloseTo.ts b/frontend/cypress/e2e/utils/isDateCloseTo.ts index f437478350..ecb7510701 100644 --- a/frontend/cypress/e2e/utils/isDateCloseTo.ts +++ b/frontend/cypress/e2e/utils/isDateCloseTo.ts @@ -6,7 +6,7 @@ export function isDateCloseTo( thresholdInSeconds: number ): boolean { const leftDateAsDayjs: Dayjs = isDayjs(leftDate) ? leftDate : dayjs(leftDate) - const rightDateAsDayjs: Dayjs = isDayjs(rightDate) ? rightDate : dayjs(leftDate) + const rightDateAsDayjs: Dayjs = isDayjs(rightDate) ? rightDate : dayjs(rightDate) return Math.abs(leftDateAsDayjs.diff(rightDateAsDayjs, 'second')) <= thresholdInSeconds } diff --git a/frontend/src/features/PriorNotification/components/shared/EditHistory/__tests__/utils.test.ts b/frontend/src/features/PriorNotification/components/shared/EditHistory/__tests__/utils.test.ts new file mode 100644 index 0000000000..3808ef27f3 --- /dev/null +++ b/frontend/src/features/PriorNotification/components/shared/EditHistory/__tests__/utils.test.ts @@ -0,0 +1,64 @@ +import { isDateCloseTo } from '@features/PriorNotification/components/shared/EditHistory/utils' +import { describe, expect, it } from '@jest/globals' +import dayjs from 'dayjs' + +describe('features/PriorNotificationList/shared/EditHistory/utils', () => { + it('isDateCloseTo() should return true when dates are within the threshold', () => { + // Given + const leftDate = dayjs('2024-01-01T10:00:00') + const rightDate = dayjs('2024-01-01T10:00:10') + const thresholdInSeconds = 10 + + // When Then + expect(isDateCloseTo(leftDate, rightDate, thresholdInSeconds)).toBe(true) + }) + + it('isDateCloseTo() should return false when dates exceed the threshold', () => { + // Given + const leftDate = dayjs('2024-01-01T10:00:00') + const rightDate = dayjs('2024-01-01T10:01:00') + const thresholdInSeconds = 30 + + // When Then + expect(isDateCloseTo(leftDate, rightDate, thresholdInSeconds)).toBe(false) + }) + + it('isDateCloseTo() should handle different date formats (string, Date, Dayjs) and return true for close dates', () => { + // Given + const leftDate = '2024-01-01T10:00:00' + const rightDate = new Date('2024-01-01T10:00:05') + const thresholdInSeconds = 10 + + // When Then + expect(isDateCloseTo(leftDate, rightDate, thresholdInSeconds)).toBe(true) + }) + + it('isDateCloseTo() should handle different date formats (string, Date, Dayjs) and return false for far dates', () => { + // Given + const leftDate = new Date('2024-01-01T10:00:00') + const rightDate = dayjs('2024-01-01T10:01:00') + const thresholdInSeconds = 30 + + // When Then + expect(isDateCloseTo(leftDate, rightDate, thresholdInSeconds)).toBe(false) + }) + + it('isDateCloseTo() should return true when dates are exactly at the threshold limit', () => { + // Given + const leftDate = dayjs('2024-01-01T10:00:00') + const rightDate = dayjs('2024-01-01T10:01:00') + const thresholdInSeconds = 60 + + // When Then + expect(isDateCloseTo(leftDate, rightDate, thresholdInSeconds)).toBe(true) + }) + + it('isDateCloseTo() should return true for identical dates with any threshold', () => { + // Given + const date = dayjs('2024-01-01T10:00:00') + const thresholdInSeconds = 0 + + // When Then + expect(isDateCloseTo(date, date, thresholdInSeconds)).toBe(true) + }) +}) diff --git a/frontend/src/features/PriorNotification/components/shared/EditHistory/utils.ts b/frontend/src/features/PriorNotification/components/shared/EditHistory/utils.ts index 6517992d06..7761c010e0 100644 --- a/frontend/src/features/PriorNotification/components/shared/EditHistory/utils.ts +++ b/frontend/src/features/PriorNotification/components/shared/EditHistory/utils.ts @@ -1,6 +1,8 @@ import { customDayjs } from '@mtes-mct/monitor-ui' +import dayjs, { isDayjs } from 'dayjs' import type { PriorNotification } from '@features/PriorNotification/PriorNotification.types' +import type { Dayjs } from 'dayjs' function getCreatedByLabel(priorNotificationDetail: PriorNotification.Detail) { if (!priorNotificationDetail.isManuallyCreated) { @@ -26,7 +28,7 @@ export function getCreationLabel(priorNotificationDetail: PriorNotification.Deta } export function getLasUpdateLabel(priorNotificationDetail: PriorNotification.Detail) { - if (priorNotificationDetail.updatedAt === priorNotificationDetail.createdAt) { + if (isDateCloseTo(priorNotificationDetail.createdAt, priorNotificationDetail.updatedAt, 1)) { return undefined } @@ -42,3 +44,14 @@ export function getLasUpdateLabel(priorNotificationDetail: PriorNotification.Det .join(' ') .concat('.') } + +export function isDateCloseTo( + leftDate: string | Date | Dayjs, + rightDate: string | Date | Dayjs, + thresholdInSeconds: number +): boolean { + const leftDateAsDayjs: Dayjs = isDayjs(leftDate) ? leftDate : dayjs(leftDate) + const rightDateAsDayjs: Dayjs = isDayjs(rightDate) ? rightDate : dayjs(rightDate) + + return Math.abs(leftDateAsDayjs.diff(rightDateAsDayjs, 'second')) <= thresholdInSeconds +} From 07d7b4281056fe958e92ca28770a562f9b5cf761 Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Mon, 4 Nov 2024 13:10:36 +0100 Subject: [PATCH 3/4] Fix last edit test --- .../e2e/side_window/manual_prior_notification_form/form.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts b/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts index d412c83ac0..066aca8b8e 100644 --- a/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts +++ b/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts @@ -118,7 +118,7 @@ context('Side Window > Manual Prior Notification Form > Form', () => { editSideWindowPriorNotification('PAGEOT JO', createdPriorNotification.reportId) cy.contains('Créé par dummy@email.gouv.fr il y a').should('exist') - cy.contains('Dernière mise à jour il y a').should('exist') + cy.contains('Dernière mise à jour par dummy@email.gouv.fr il y a').should('exist') cy.intercept('PUT', `/bff/v1/prior_notifications/manual/${createdPriorNotification.reportId}`).as( 'updateManualPriorNotification' From 449a8fc9e94d1b914ad62325b1bdc22752ecb738 Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Tue, 5 Nov 2024 09:20:42 +0100 Subject: [PATCH 4/4] Remove assertion --- .../e2e/side_window/manual_prior_notification_form/form.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts b/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts index 066aca8b8e..9f4a08911f 100644 --- a/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts +++ b/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts @@ -118,7 +118,6 @@ context('Side Window > Manual Prior Notification Form > Form', () => { editSideWindowPriorNotification('PAGEOT JO', createdPriorNotification.reportId) cy.contains('Créé par dummy@email.gouv.fr il y a').should('exist') - cy.contains('Dernière mise à jour par dummy@email.gouv.fr il y a').should('exist') cy.intercept('PUT', `/bff/v1/prior_notifications/manual/${createdPriorNotification.reportId}`).as( 'updateManualPriorNotification'