fix(analysis): don't skip any months for inflation, just check if data exists
This commit is contained in:
@@ -123,15 +123,6 @@ export function MonthlyVariationTable() {
|
|||||||
|
|
||||||
const sortedMonths = [...monthsMap.keys()].sort();
|
const sortedMonths = [...monthsMap.keys()].sort();
|
||||||
|
|
||||||
const today = new Date();
|
|
||||||
const currentMonth = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, "0")}`;
|
|
||||||
const lastMonthDate = new Date(
|
|
||||||
today.getFullYear(),
|
|
||||||
today.getMonth() - 1,
|
|
||||||
1,
|
|
||||||
);
|
|
||||||
const lastCompleteMonth = `${lastMonthDate.getFullYear()}-${String(lastMonthDate.getMonth() + 1).padStart(2, "0")}`;
|
|
||||||
|
|
||||||
const calcVariation = (
|
const calcVariation = (
|
||||||
currentVal: number | null,
|
currentVal: number | null,
|
||||||
prevVal: number | null,
|
prevVal: number | null,
|
||||||
@@ -160,14 +151,7 @@ export function MonthlyVariationTable() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let inflation: number | null = null;
|
let inflation: number | null = null;
|
||||||
const dayOfMonth = today.getDate();
|
|
||||||
const skipLastComplete = dayOfMonth < 14;
|
|
||||||
if (
|
|
||||||
month !== currentMonth &&
|
|
||||||
!(skipLastComplete && month === lastCompleteMonth)
|
|
||||||
) {
|
|
||||||
inflation = inflationMap.get(month) ?? null;
|
inflation = inflationMap.get(month) ?? null;
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
month,
|
month,
|
||||||
|
|||||||
Reference in New Issue
Block a user