260401_02_ENH: 브랜드의 gap 부분 2개 연도 나올수 있도록 수정
This commit is contained in:
@@ -68,26 +68,31 @@ const CategoryPage = () => {
|
|||||||
const years = Array.from(new Set(rows.map((row) => Number(row.year))))
|
const years = Array.from(new Set(rows.map((row) => Number(row.year))))
|
||||||
.filter((year) => Number.isFinite(year))
|
.filter((year) => Number.isFinite(year))
|
||||||
.sort((a, b) => b - a)
|
.sort((a, b) => b - a)
|
||||||
.slice(0, 2);
|
.slice(0, -1);
|
||||||
|
|
||||||
if (years.length < 2) {
|
if(years.length === 0) {
|
||||||
nextMap[f.requestKeyResolved] = rows;
|
nextMap[f.requestKeyResolved] = rows;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [currentYear, prevYear] = years;
|
const gapRowsByYear = new Map<number, BannerRow>();
|
||||||
const gapRow = buildGapRow(rows, prevYear, currentYear, "LG");
|
|
||||||
|
|
||||||
if (!gapRow) {
|
years.forEach((year) => {
|
||||||
nextMap[f.requestKeyResolved] = rows;
|
const currentYear = year;
|
||||||
return;
|
const prevYear = year - 1;
|
||||||
}
|
const gapRow = buildGapRow(rows, prevYear, currentYear, "LG");
|
||||||
|
|
||||||
|
if(gapRow !== null){
|
||||||
|
gapRowsByYear.set(currentYear, gapRow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const nextRows: BannerRow[] = [];
|
const nextRows: BannerRow[] = [];
|
||||||
rows.forEach((row) => {
|
rows.forEach((row) => {
|
||||||
nextRows.push(row);
|
nextRows.push(row);
|
||||||
|
|
||||||
if (Number(row.year) === currentYear && row.rowLabel === "LG") {
|
const gapRow = gapRowsByYear.get(Number(row.year));
|
||||||
|
if (row.rowLabel === "LG" && gapRow) {
|
||||||
nextRows.push(gapRow);
|
nextRows.push(gapRow);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user