Skip to content

Commit

Permalink
Fix lan species not displayed in the message body
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Feb 27, 2024
1 parent cfcd03e commit c42d515
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-undef */

context('Vessel sidebar fishing tab', () => {
context('Vessel sidebar logbook tab', () => {
beforeEach(() => {
cy.loadPath('/#@-824534.42,6082993.21,8.70')
})
Expand Down Expand Up @@ -93,16 +93,20 @@ context('Vessel sidebar fishing tab', () => {
cy.get('*[data-cy="vessel-fishing-message"]').eq(7).contains('Fin de pêche')

cy.get('*[data-cy="vessel-fishing-message"]').eq(8).contains('Préavis (notification de retour au port)')
cy.get('*[data-cy="vessel-fishing-message-body"]').eq(8).contains('MERLU NOIR DU CAP (HKC)')

cy.get('*[data-cy="vessel-fishing-message"]').eq(9).contains('Retour au port')

cy.get('*[data-cy="vessel-fishing-message"]').eq(10).contains('Déclaration de capture')
cy.get('*[data-cy="vessel-fishing-message"]').eq(10).siblings().eq(1).contains('MESSAGE CORRIGÉ')
cy.get('*[data-cy="vessel-fishing-message-body"]').eq(10).contains('BONITE A DOS RAYE (BON)')

cy.get('*[data-cy="vessel-fishing-message"]').eq(11).contains('Déclaration de rejets')
cy.get('*[data-cy="vessel-fishing-message-body"]').eq(11).contains('LANGOUSTINE (NEP)')

cy.get('*[data-cy="vessel-fishing-message"]').eq(12).contains('Débarquement')
cy.get('*[data-cy="vessel-fishing-message"]').eq(12).siblings().eq(1).contains('MESSAGE SUPPRIMÉ')
cy.get('*[data-cy="vessel-fishing-message-body"]').eq(12).contains('BONITE A DOS RAYE (BON)')
})

it('Fishing Should contain the vessel FLUX logbook messages', () => {
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/features/Logbook/Logbook.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ export type CPSMessageValue = {
mesh?: number
}

export type LANMessageValue = {
catchLanded: LogbookCatch[]
landingDatetimeUtc: string
port: string
portName?: string
sender?: string
}

export type ProtectedSpeciesCatch = {
careMinutes?: number
comment?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ import { buildCatchArray } from '../../../../utils'
import { WeightType } from '../constants'
import { NoValue, Table, TableBody, TableKey, TableRow, TableValue, Zone, SpeciesList } from '../styles'

export function LANMessage({ message }) {
import type { LANMessageValue } from '@features/Logbook/Logbook.types'

type LANMessageProps = {
message: LANMessageValue
}
export function LANMessage({ message }: LANMessageProps) {
const catchesWithProperties = useMemo(() => {
if (!message?.catches) {
if (!message?.catchLanded) {
return []
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/Logbook/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const LogbookMessageType = {
code: 'LAN',
displayCode: 'LAN',
fullName: 'Débarquement',
isFilterable: false,
isFilterable: true,
name: 'Débarquement'
},
NOT_COE: {
Expand Down

0 comments on commit c42d515

Please sign in to comment.