Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevent 0 on renumeration results step if declaration modified #2163

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -158,6 +158,10 @@ export const RemunerationForm = () => {
draft["remunerations-resultat"] = undefined;
savePageData("remunerations-resultat", undefined);
}
if (data.estCalculable === "oui" && formData[stepName]?.estCalculable === "non") {
draft["remunerations-resultat"] = undefined;
savePageData("remunerations-resultat", undefined);
}
if (data.estCalculable !== formData[stepName]?.estCalculable) {
draft[stepName] = getModifiedFormValues(dirtyFields, data) as DeclarationDTO[typeof stepName];
} else {
Original file line number Diff line number Diff line change
@@ -60,16 +60,12 @@ export const ResultatGlobalForm = () => {

const computed = computeDeclarationIndex(DeclarationComputerInputBuilder.fromDeclarationDTO(formData));

// We don't compute the index if we only read an existing declaration.
const defaultValues =
formData["declaration-existante"].status === "consultation"
? formData[stepName]
: {
...formData[stepName],
index: computed.index,
points: computed.points,
pointsCalculables: computed.computablePoints,
};
const defaultValues = {
...formData[stepName],
index: computed.index,
points: computed.points,
pointsCalculables: computed.computablePoints,
};

const methods = useForm<FormType>({
mode: "onChange",