Skip to content

Commit

Permalink
Fiche navire - Afficher l'indication mer/port de la position VMS dans…
Browse files Browse the repository at this point in the history
… la liste des positions (#3540)

## Linked issues

- Resolve #3204

----

- [ ] Tests E2E (Cypress)
  • Loading branch information
louptheron authored Aug 14, 2024
2 parents cb10faa + 995a803 commit 68bf0bc
Show file tree
Hide file tree
Showing 15 changed files with 386 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data class Position(
val positionType: PositionType,
val isManual: Boolean? = null,
val isFishing: Boolean? = null,
val isAtPort: Boolean? = null,

val latitude: Double,
val longitude: Double,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ data class PositionDataOutput(
val positionType: PositionType,
val isManual: Boolean? = null,
val isFishing: Boolean? = null,
val isAtPort: Boolean? = null,
) {
companion object {
fun fromPosition(position: Position): PositionDataOutput {
Expand All @@ -44,6 +45,7 @@ data class PositionDataOutput(
positionType = position.positionType,
isManual = position.isManual,
isFishing = position.isFishing,
isAtPort = position.isAtPort,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ data class PositionEntity(
val isManual: Boolean? = false,
@Column(name = "is_fishing")
val isFishing: Boolean? = false,
@Column(name = "is_at_port")
val isAtPort: Boolean? = null,

// Mandatory fields
@Enumerated(EnumType.STRING)
Expand Down Expand Up @@ -78,6 +80,7 @@ data class PositionEntity(
positionType = positionType,
isManual = isManual,
isFishing = isFishing,
isAtPort = isAtPort,
)

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ interface DBPositionRepository : CrudRepository<PositionEntity, Long> {
"p.course, " +
"p.position_type, " +
"p.is_manual, " +
"p.is_fishing " +
"p.is_fishing, " +
"p.is_at_port " +
"from positions p " +
"where p.internal_reference_number = :internalReferenceNumber " +
"and p.date_time >= :from " +
Expand Down Expand Up @@ -61,7 +62,8 @@ interface DBPositionRepository : CrudRepository<PositionEntity, Long> {
"p.course, " +
"p.position_type, " +
"p.is_manual, " +
"p.is_fishing " +
"p.is_fishing, " +
"p.is_at_port " +
"from positions p " +
"where p.external_reference_number = :externalReferenceNumber " +
"and p.date_time >= :from " +
Expand Down Expand Up @@ -94,7 +96,8 @@ interface DBPositionRepository : CrudRepository<PositionEntity, Long> {
"p.course, " +
"p.position_type, " +
"p.is_manual, " +
"p.is_fishing " +
"p.is_fishing, " +
"p.is_at_port " +
"from positions p " +
"where p.ircs = :ircs " +
"and p.date_time >= :from " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69278,3 +69278,6 @@ INSERT INTO POSITIONS (INTERNAL_REFERENCE_NUMBER, EXTERNAL_REFERENCE_NUMBER, MMS
('U_W0NTFINDME','ABC123456',null,'TALK2ME','MALOTRU','FR','FR','DE',null,57.348,-21.219,7.5,11,(now() AT TIME ZONE 'UTC')::TIMESTAMP - interval '20 days 9 hours','VMS'),
('U_W0NTFINDME','ABC123456',null,'TALK2ME','MALOTRU','FR','FR','DE',null,57.64,-21.117,8.6,17,(now() AT TIME ZONE 'UTC')::TIMESTAMP - interval '20 days 3 hours','VMS');

update positions
set is_at_port = true
where INTERNAL_REFERENCE_NUMBER = 'FAK000999999' and date_time < (now() AT TIME ZONE 'UTC')::TIMESTAMP - interval '22 hours';
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,62 @@ class VesselLightControllerITests {
// Given
val now = ZonedDateTime.now().minusDays(1)
val firstPosition = Position(
null, "FR224226850", "224226850", null, null, null, null, PositionType.AIS, false, false, 16.445, 48.2525, 1.8, 180.0,
now.minusHours(
id = null,
internalReferenceNumber = "FR224226850",
mmsi = "224226850",
ircs = null,
externalReferenceNumber = null,
vesselName = null,
flagState = null,
positionType = PositionType.AIS,
isManual = false,
isFishing = false,
course = 16.445,
latitude = 48.2525,
longitude = 1.8,
speed = 180.0,
isAtPort = false,
dateTime = now.minusHours(
4,
),
)
val secondPosition = Position(
null, "FR224226850", "224226850", null, null, null, null, PositionType.AIS, false, false, 16.445, 48.2525, 1.8, 180.0,
now.minusHours(
id = null,
internalReferenceNumber = "FR224226850",
mmsi = "224226850",
ircs = null,
externalReferenceNumber = null,
vesselName = null,
flagState = null,
positionType = PositionType.AIS,
isManual = false,
isFishing = false,
course = 16.445,
latitude = 48.2525,
longitude = 1.8,
speed = 180.0,
isAtPort = false,
dateTime = now.minusHours(
3,
),
)
val thirdPosition = Position(
null, "FR224226850", "224226850", null, null, null, null, PositionType.AIS, false, false, 16.445, 48.2525, 1.8, 180.0,
now.minusHours(
null,
internalReferenceNumber = "FR224226850",
mmsi = "224226850",
ircs = null,
externalReferenceNumber = null,
vesselName = null,
flagState = null,
positionType = PositionType.AIS,
isManual = false,
isFishing = false,
course = 16.445,
latitude = 48.2525,
longitude = 1.8,
speed = 180.0,
isAtPort = false,
dateTime = now.minusHours(
2,
),
)
Expand Down
Loading

0 comments on commit 68bf0bc

Please sign in to comment.