fix: add all columns to month/day/hour views for consistent display
Some checks failed
CI / Engine — lint / typecheck / test (push) Has been cancelled
CI / API — lint / typecheck / test (push) Has been cancelled
CI / Web — typecheck / lint / build (push) Has been cancelled

- Hour: raw profile %, DC MW, output MW
- Day: average profile %, DC MW, sum MWh
- Month: average profile %, DC MW, sum MWh

All levels now show: Solar 8760, DC MW, Solar MW, Wind, Total RE, Client End, Load

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Manohar Gupta 2026-05-16 15:59:43 +05:30
parent fdb387e74c
commit e286f930f1

View file

@ -789,6 +789,9 @@ function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly:
const isMonthExpanded = expandedMonths.has(monthKey);
const solarMo = hasSolar ? computeMonthTotal(year, month, true) : 0;
const windMo = hasWind ? computeMonthTotal(year, month, false) : 0;
// Average profile for month
const solarProfileMo = hasSolarProfile ? computeMonthAvgProfile(year, month, hourly_solar_profile) : 0;
const windProfileMo = hasWindProfile ? computeMonthAvgProfile(year, month, hourly_wind_profile) : 0;
const totalReMo = hasTotalRe ? computeMonthTotalNew(year, month, hourly_total_re) : 0;
const clientEndMo = hasClientEnd ? computeMonthTotalNew(year, month, hourly_client_end) : 0;
const loadMo = hasLoad ? computeMonthTotalNew(year, month, hourly_load) : 0;
@ -803,11 +806,16 @@ function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly:
>
<span className="text-[10px] w-4">{isMonthExpanded ? "▼" : "▶"}</span>
<span className="w-20 text-muted-foreground">{monthLabel}</span>
{hasSolar && <span className="text-orange-700/80 w-24">{Math.round(solarMo).toLocaleString()} MWh</span>}
{hasWind && <span className="text-blue-700/80 w-24">{Math.round(windMo).toLocaleString()} MWh</span>}
{hasTotalRe && <span className="text-green-700/80 w-24">{Math.round(totalReMo).toLocaleString()} MWh</span>}
{hasClientEnd && <span className="text-purple-700/80 w-24">{Math.round(clientEndMo).toLocaleString()} MWh</span>}
{hasLoad && <span className="text-gray-700/80 w-20">{Math.round(loadMo).toLocaleString()} MWh</span>}
{/* Month: avg profile %, DC MW, sum MWh */}
{hasSolar && <span className="text-orange-700/80 w-14">{(solarProfileMo * 100).toFixed(1)}%</span>}
{hasSolar && <span className="text-orange-700/80 w-10">{solarDCMW || '-'}</span>}
{hasSolar && <span className="text-orange-700/80 w-14">{Math.round(solarMo).toLocaleString()}</span>}
{hasWind && <span className="text-blue-700/80 w-14">-</span>}
{hasWind && <span className="text-blue-700/80 w-10">{windMW || '-'}</span>}
{hasWind && <span className="text-blue-700/80 w-14">{Math.round(windMo).toLocaleString()}</span>}
{hasTotalRe && <span className="text-green-700/80 w-14">{Math.round(totalReMo).toLocaleString()}</span>}
{hasClientEnd && <span className="text-purple-700/80 w-14">{Math.round(clientEndMo).toLocaleString()}</span>}
{hasLoad && <span className="text-gray-700/80 w-10">{Math.round(loadMo).toLocaleString()}</span>}
</button>
{/* Day rows (expandable) */}
@ -817,6 +825,9 @@ function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly:
const isDayExpanded = expandedDays.has(dayKey);
const solarDy = hasSolar ? computeDayTotal(year, month, day, true) : 0;
const windDy = hasWind ? computeDayTotal(year, month, day, false) : 0;
// Average profile for day
const solarProfileDay = hasSolarProfile ? computeDayAvgProfile(year, month, day, hourly_solar_profile) : 0;
const windProfileDay = hasWindProfile ? computeDayAvgProfile(year, month, day, hourly_wind_profile) : 0;
const totalReDy = hasTotalRe ? computeDayTotalNew(year, month, day, hourly_total_re) : 0;
const clientEndDy = hasClientEnd ? computeDayTotalNew(year, month, day, hourly_client_end) : 0;
const loadDy = hasLoad ? computeDayTotalNew(year, month, day, hourly_load) : 0;
@ -829,11 +840,16 @@ function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly:
>
<span className="text-[10px] w-4">{isDayExpanded ? "▼" : "▶"}</span>
<span className="w-12 text-muted-foreground/80">{monthLabel} {day}</span>
{hasSolar && <span className="text-orange-600/70 w-20">{Math.round(solarDy).toLocaleString()}</span>}
{hasWind && <span className="text-blue-600/70 w-20">{Math.round(windDy).toLocaleString()}</span>}
{hasTotalRe && <span className="text-green-600/70 w-20">{Math.round(totalReDy).toLocaleString()}</span>}
{hasClientEnd && <span className="text-purple-600/70 w-20">{Math.round(clientEndDy).toLocaleString()}</span>}
{hasLoad && <span className="text-gray-600/70 w-16">{Math.round(loadDy).toLocaleString()}</span>}
{/* Day: average profile %, DC MW, sum MWh */}
{hasSolar && <span className="text-orange-600/70 w-14">{(solarProfileDay * 100).toFixed(1)}%</span>}
{hasSolar && <span className="text-orange-600/70 w-10">{solarDCMW || '-'}</span>}
{hasSolar && <span className="text-orange-600/70 w-14">{Math.round(solarDy)}</span>}
{hasWind && <span className="text-blue-600/70 w-14">-</span>}
{hasWind && <span className="text-blue-600/70 w-10">{windMW || '-'}</span>}
{hasWind && <span className="text-blue-600/70 w-14">{Math.round(windDy)}</span>}
{hasTotalRe && <span className="text-green-600/70 w-14">{Math.round(totalReDy)}</span>}
{hasClientEnd && <span className="text-purple-600/70 w-14">{Math.round(clientEndDy)}</span>}
{hasLoad && <span className="text-gray-600/70 w-10">{Math.round(loadDy)}</span>}
</button>
{/* Hour values - vertical stack */}
@ -844,7 +860,12 @@ function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly:
const hourIdx = (day - 1) * 24 + hour;
const solarHr = hasSolar ? getDayData(year, month, day, true)[hourIdx % 24] : 0;
const windHr = hasWind ? getDayData(year, month, day, false)[hourIdx % 24] : 0;
// Get new column data by hour index
// Raw profile values
const yearDataProfile = getYearProfile(year, hourly_solar_profile);
const hourProfile = yearDataProfile.length > hourIdx ? yearDataProfile[hourIdx] : 0;
const yearDataProfileW = getYearProfile(year, hourly_wind_profile);
const hourProfileW = yearDataProfileW.length > hourIdx ? yearDataProfileW[hourIdx] : 0;
// Total RE and Client End
const yearDataNew = getYearDataNew(year, hourly_total_re);
const hourDataTotalRe = yearDataNew.length > hourIdx ? yearDataNew[hourIdx] : 0;
const yearDataClient = getYearDataNew(year, hourly_client_end);
@ -854,11 +875,18 @@ function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly:
return (
<div key={h} className="flex items-center gap-2 text-[9px] border-b border-border/30 px-1">
<span className="w-8 text-muted-foreground">{String(h).padStart(2, '0')}:00</span>
{/* Solar 8760: raw profile, DC MW, Solar MW */}
{hasSolar && <span className="text-orange-700 w-14 text-right">{(hourProfile * 100).toFixed(1)}%</span>}
{hasSolar && <span className="text-orange-600/70 w-10 text-right">{solarDCMW || '-'}</span>}
{hasSolar && <span className="text-orange-700 w-14 text-right">{Math.round(solarHr)}</span>}
{/* Wind 8760, MW, Wind MW */}
{hasWind && <span className="text-blue-700 w-14 text-right">-</span>}
{hasWind && <span className="text-blue-600/70 w-10 text-right">{windMW || '-'}</span>}
{hasWind && <span className="text-blue-700 w-14 text-right">{Math.round(windHr)}</span>}
{/* Total RE, Client End, Load */}
{hasTotalRe && <span className="text-green-700 w-14 text-right">{Math.round(hourDataTotalRe)}</span>}
{hasClientEnd && <span className="text-purple-700 w-14 text-right">{Math.round(hourDataClient)}</span>}
{hasLoad && <span className="text-gray-700 w-12 text-right">{Math.round(hourDataLoad)}</span>}
{hasLoad && <span className="text-gray-700 w-10 text-right">{Math.round(hourDataLoad)}</span>}
</div>
);
})}