You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepository.kt
+5
Original file line number
Diff line number
Diff line change
@@ -151,6 +151,7 @@ class JpaLogbookReportRepository(
Copy file name to clipboardexpand all lines: backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBLogbookReportRepository.kt
* The last `MAX(lr_all.operationDateTime)` date is used to display the fishing trip positions, hence LAN are excluded.
353
+
*/
332
354
@Query(
333
-
"""SELECT new fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.interfaces.VoyageTripNumberAndDates(e.tripNumber, MIN(e.operationDateTime), MAX(e.operationDateTime))
355
+
"""SELECT new fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.interfaces.VoyageTripNumberAndDates(
356
+
e.tripNumber,
357
+
MIN(e.operationDateTime),
358
+
MAX(e.operationDateTime),
359
+
MAX(CASE WHEN messageType != 'LAN' THEN e.operationDateTime END)
360
+
)
334
361
FROM LogbookReportEntity e
335
362
WHERE e.internalReferenceNumber = :internalReferenceNumber
336
363
AND e.tripNumber IS NOT NULL
337
364
AND e.operationType IN ('DAT', 'COR')
338
365
AND e.operationDateTime <= :beforeDateTime
339
366
AND NOT e.isTestMessage
340
367
GROUP BY e.tripNumber
341
-
ORDER BY 2 DESC""",
368
+
ORDER BY 2 DESC""",
342
369
)
343
370
funfindTripsBeforeDatetime(
344
371
internalReferenceNumber:String,
345
372
beforeDateTime:Instant,
346
373
pageable:Pageable,
347
374
): List<VoyageTripNumberAndDates>
348
375
376
+
/**
377
+
* Subqueries are required to get MIN and MAX date_time outside the clause :
378
+
* `e.operationDateTime BETWEEN :afterDateTime AND :beforeDateTime`
379
+
*
380
+
* The last `MAX(lr_all.activityDateTime)` date is used to display the fishing trip positions, hence LAN are excluded.
381
+
*/
349
382
@Query(
350
383
"""
351
384
SELECT new fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.interfaces.VoyageTripNumberAndDates(
Copy file name to clipboardexpand all lines: backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/VoyageTripNumberAndDates.kt
+2
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,11 @@ class VoyageTripNumberAndDates(
Copy file name to clipboardexpand all lines: backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepositoryITests.kt
+1
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,7 @@ class JpaLogbookReportRepositoryITests : AbstractDBTests() {
0 commit comments