fix(qa): evaluate credit warnings from declared contractual days
This commit is contained in:
@@ -38,6 +38,7 @@ export function financialPlanWarningMetrics(
|
||||
: undefined;
|
||||
const metrics: PlanWarningMetrics = {
|
||||
currency: plan.currency,
|
||||
creditDays: inputCreditDays(plan.creditTermDays),
|
||||
fundingGap:
|
||||
year === 0
|
||||
? read('funding', 'Diferença por financiar', 1)
|
||||
@@ -97,7 +98,10 @@ export function financialPlanWarnings(
|
||||
id: `${year}-${w.id}`,
|
||||
message: `${year}: ${w.message}`,
|
||||
}));
|
||||
if ((plan.salesCollectionLagMonths ?? 0) > 3)
|
||||
if (
|
||||
inputCreditDays(plan.creditTermDays) === undefined &&
|
||||
(plan.salesCollectionLagMonths ?? 0) > 3
|
||||
)
|
||||
warnings.push({
|
||||
id: `${year}-credit`,
|
||||
message: `${year}: O prazo de recebimento é superior a três meses no modelo mensal e pressiona a caixa. Confirme o prazo indicado.`,
|
||||
@@ -106,3 +110,9 @@ export function financialPlanWarnings(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function inputCreditDays(value: string | undefined) {
|
||||
return value && /^\d+$/.test(value) && Number(value) <= 365
|
||||
? Number(value)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user