Skip to content

Commit 2ec866c

Browse files
committed
feat(prélèvement): utilise l'année du plan du prélèvement pour la référence
1 parent b8e49d7 commit 2ec866c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

server/controllers/sampleController.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,13 @@ export const sampleRouter = {
254254
await companyRepository.upsert(sampleToCreate.company);
255255
}
256256

257+
const programmingPlan = await getAndCheckProgrammingPlan(
258+
sampleToCreate.programmingPlanId
259+
);
260+
257261
const reference = await getNewReference(
258262
user.region,
259-
new Date().getFullYear()
263+
programmingPlan.year
260264
);
261265

262266
const sample = {

server/routers/test/sample.router.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addDays, format } from 'date-fns';
1+
import { addDays } from 'date-fns';
22
import { constants } from 'http2';
33
import { omit } from 'lodash-es';
44
import { MatrixEffective } from 'maestro-shared/referential/Matrix/Matrix';
@@ -423,7 +423,7 @@ describe('Sample router', () => {
423423
id: sample.sampler.id,
424424
name: sample.sampler.name
425425
},
426-
reference: `${Regions[user.region as Region].shortName}-${format(new Date(), 'yy')}-0000${expectedIncrement}`
426+
reference: `${Regions[user.region as Region].shortName}-25-000${expectedIncrement}`
427427
})
428428
);
429429

shared/test/programmingPlanFixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const PPVValidatedProgrammingPlanFixture = genProgrammingPlan({
6262
region,
6363
status: 'Validated'
6464
})),
65-
year: new Date().getFullYear()
65+
year: 2025
6666
});
6767

6868
export const PPVInProgressProgrammingPlanFixture = genProgrammingPlan({

0 commit comments

Comments
 (0)