WIP main worktree changes before merge

This commit is contained in:
2026-03-13 00:20:22 -04:00
parent 58bf80189d
commit e5141238fb
25 changed files with 940 additions and 208 deletions

View File

@@ -282,17 +282,20 @@ export function buildRows(
const rows = snapshot.statement_rows?.[statement] ?? [];
for (const row of rows) {
const rowValues = row.values ?? {};
const rowUnits = row.units ?? {};
const sourceFactIds = row.sourceFactIds ?? [];
const existing = rowMap.get(row.key);
if (!existing) {
rowMap.set(row.key, {
...row,
values: Object.fromEntries(
Object.entries(row.values).filter(([periodId]) => selectedPeriodIds.has(periodId))
Object.entries(rowValues).filter(([periodId]) => selectedPeriodIds.has(periodId))
),
units: Object.fromEntries(
Object.entries(row.units).filter(([periodId]) => selectedPeriodIds.has(periodId))
Object.entries(rowUnits).filter(([periodId]) => selectedPeriodIds.has(periodId))
),
sourceFactIds: [...row.sourceFactIds]
sourceFactIds: [...sourceFactIds]
});
if (Object.keys(rowMap.get(row.key)?.values ?? {}).length === 0) {
@@ -308,19 +311,19 @@ export function buildRows(
existing.parentKey = row.parentKey;
}
for (const [periodId, value] of Object.entries(row.values)) {
for (const [periodId, value] of Object.entries(rowValues)) {
if (selectedPeriodIds.has(periodId) && !(periodId in existing.values)) {
existing.values[periodId] = value;
}
}
for (const [periodId, unit] of Object.entries(row.units)) {
for (const [periodId, unit] of Object.entries(rowUnits)) {
if (selectedPeriodIds.has(periodId) && !(periodId in existing.units)) {
existing.units[periodId] = unit;
}
}
for (const factId of row.sourceFactIds) {
for (const factId of sourceFactIds) {
if (!existing.sourceFactIds.includes(factId)) {
existing.sourceFactIds.push(factId);
}