Skip to content

Commit

Permalink
fix(exports): teste avec les surfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed Feb 12, 2024
1 parent 8c83dc5 commit f68bce9
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('generateAutresInfos', () => {
expect(generateAutresInfos(features, { initialCulture: '01.13.41.1' })).toBe('1.1, Chantenay à cœur rouge, semis le 31/03/2023, 1ha ; 1.2, Coucou')

expect(generateAutresInfos(features, { withNotes: false })).toBe('1.1, 01.13.41.1 Carottes, Chantenay à cœur rouge, semis le 31/03/2023, 1ha ; 1.2, 01.13.41.1 Carottes')
expect(generateAutresInfos(features, { withName: falsewith, Notes: false })).toBe('01.13.41.1 Carottes, Chantenay à cœur rouge, semis le 31/03/2023, 1ha ; 01.13.41.1 Carottes')
expect(generateAutresInfos(features, { withName: false, withNotes: false })).toBe('01.13.41.1 Carottes, Chantenay à cœur rouge, semis le 31/03/2023, 1ha ; 01.13.41.1 Carottes')
expect(generateAutresInfos(features, { withName: false, withNotes: false, withVariete: false })).toBe('01.13.41.1 Carottes, semis le 31/03/2023, 1ha ; 01.13.41.1 Carottes')
expect(generateAutresInfos(features, { withDate: false, withName: false, withNotes: false })).toBe('01.13.41.1 Carottes, Chantenay à cœur rouge, 1ha ; 01.13.41.1 Carottes')
expect(generateAutresInfos(features, { withDate: false, withName: false, withNotes: false, withSurface: false })).toBe('01.13.41.1 Carottes, Chantenay à cœur rouge ; 01.13.41.1 Carottes')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('CertipaqExporter', () => {
'',
'',
new Date('2021-01-01T00:00:00.000Z'),
'01.19.10.7 Trèfle, semis le 01/03/2023, Réduction de conversion (Dérogation acceptée)',
'0.70ha / 01.19.10.7 Trèfle, semis le 01/03/2023, 0.30ha, Réduction de conversion (Dérogation acceptée)',
'',
'',
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('CertisExporter', () => {
'',
'01.19.10.8',
'Luzerne',
'01.19.10.7 Trèfle, 4 feuilles',
'0.70ha / 01.19.10.7 Trèfle, 4 feuilles, 0.30ha',
'AB',
'01.19.10.7 Trèfle, semis le 01/03/2023',
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('CertisudExporter', () => {
'Luzerne',
// expect.closeTo(1.0), // in vite@5 + vitest@1
1.0464881572673355,
'2.1, Réduction de conversion (Dérogation acceptée)',
'2.1, 0.70ha, Réduction de conversion (Dérogation acceptée)',
'AB',
new Date('2021-01-01T00:00:00.000Z'),
'3'
Expand All @@ -57,7 +57,7 @@ describe('CertisudExporter', () => {
'Trèfle',
// expect.closeTo(1.0), // in vite@5 + vitest@1
1.0464881572673355,
'2.1, 4 feuilles, semis le 01/03/2023, Réduction de conversion (Dérogation acceptée)',
'2.1, 4 feuilles, semis le 01/03/2023, 0.30ha, Réduction de conversion (Dérogation acceptée)',
'AB',
new Date('2021-01-01T00:00:00.000Z'),
'3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('ControlUnionExporter', () => {
1.0464881572673355,
new Date('2021-01-01T00:00:00.000Z'),
'AB',
'2.1, 01.19.10.7 Trèfle, 4 feuilles, semis le 01/03/2023, Réduction de conversion (Dérogation acceptée)',
'2.1, 0.70ha / 01.19.10.7 Trèfle, 4 feuilles, semis le 01/03/2023, 0.30ha, Réduction de conversion (Dérogation acceptée)',
'3',
'01.19.10.8'
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('DefaultExporter', () => {
'AB',
new Date('2021-01-01T00:00:00.000Z'),
'',
'01.19.10.7 Trèfle, 4 feuilles, semis le 01/03/2023, Réduction de conversion (Dérogation acceptée)',
'0.70ha / 01.19.10.7 Trèfle, 4 feuilles, semis le 01/03/2023, 0.30ha, Réduction de conversion (Dérogation acceptée)',
''
],
[
Expand Down
4 changes: 2 additions & 2 deletions src/components/Features/ExportStrategies/OcaciaExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const getSheet = ({ featureCollection, permissions }) => {
// N° Cadastre
props.cadastre,
// Variété / infos
generateAutresInfos([{ id, geometry, properties: props }], { withDate: false, withName: false, withNotes: false, withVariete: true, initialCulture: culture?.code_cpf }),
generateAutresInfos([{ id, geometry, properties: props }], { withDate: false, withName: false, withNotes: false, withSurface: false, withVariete: true, initialCulture: culture?.code_cpf }),
// C0 - AB - C1 - C2 - C3
props.conversion_niveau === 'CONV' ? surfaceHa : '',
props.conversion_niveau === 'AB' ? surfaceHa : '',
Expand All @@ -67,7 +67,7 @@ const getSheet = ({ featureCollection, permissions }) => {
// Date conv #K
props.engagement_date ? new Date(props.engagement_date) : '',
// Observation / date de semis
generateAutresInfos([{ id, geometry, properties: props }], { withAnnotations: true, withDate: true, withName: false, withNotes: true, withVariete: false, initialCulture: culture?.code_cpf, permissions }),
generateAutresInfos([{ id, geometry, properties: props }], { withAnnotations: true, withDate: true, withName: false, withNotes: true, withSurface: true, withVariete: false, initialCulture: culture?.code_cpf, permissions }),
// Précédent
'',
// Anté précédent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('OcaciaExporter', () => {
'',
'',
new Date('2021-01-01T00:00:00.000Z'),
'01.19.10.7 Trèfle, semis le 01/03/2023, Réduction de conversion (Dérogation acceptée)',
'0.70ha / 01.19.10.7 Trèfle, semis le 01/03/2023, 0.30ha, Réduction de conversion (Dérogation acceptée)',
'',
'',
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('QualisudExporter', () => {
],
[
'01.19.10.8',
'01.19.10.7 Trèfle, 4 feuilles, semis le 01/03/2023, Réduction de conversion (Dérogation acceptée)',
'0.70ha / 01.19.10.7 Trèfle, 4 feuilles, semis le 01/03/2023, 0.30ha, Réduction de conversion (Dérogation acceptée)',
'ilot 2, parcelle 1',
1.0464881572673355,
'AB',
Expand Down
4 changes: 2 additions & 2 deletions src/components/Features/__fixtures__/record-for-exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
"engagement_date": "2021-01-01",
"conversion_niveau": "AB",
"cultures": [
{ "id": 1, "CPF": "01.19.10.8" },
{ "id": 2, "CPF": "01.19.10.7", "date_semis": "2023-03-01", "variete": "4 feuilles" }
{ "id": 1, "CPF": "01.19.10.8", "surface": "0.70" },
{ "id": 2, "CPF": "01.19.10.7", "date_semis": "2023-03-01", "variete": "4 feuilles", "surface": "0.30" }
],
"commentaire": "troisième parcelle de Luzerne et de trèfle engagée à un autre moment, avec une autre culture",
"annotations": [
Expand Down

0 comments on commit f68bce9

Please sign in to comment.