fix(parcel-sync): paperCfNo bug, status filter, enrichment robustness

BUGS FIXED:
- paperCfNo does NOT exist in eTerra API — field is paperLbNo
  Renamed withPaperCf → withPaperLb everywhere (type, scan, UI)
- Area fields: only measuredArea and legalArea exist on immovable/list
  Removed phantom area/areaValue/suprafata checks from import filter

FILTERING TIGHTENED:
- Quality gate now requires status=1 (active) in eTerra
- Items with status≠1 are filtered out before import
- Quality breakdown adds: withActiveStatus, withLandbook counters
- Import attributes now store MEASURED_AREA, LEGAL_AREA, HAS_LANDBOOK
- workspace.nomenPk used instead of workspacePk for accuracy

ENRICHMENT ROBUSTNESS:
- Area fallback: when AREA_VALUE is missing (no-geom), enrichment
  now falls back to listItem.measuredArea/legalArea from immovable list
- Post-enrichment verification: logs 100% coverage or warns about gaps
- EnrichResult type extended with totalFeatures + unenrichedCount

UI UPDATES:
- Quality grid shows 6 stats: cadRef, CF/LB, paperCad, area, active, landbook
- Filter explanation updated: 'inactive sau fără date' instead of old text
This commit is contained in:
AI Assistant
2026-03-07 20:25:05 +02:00
parent af2631920f
commit f9594fff71
3 changed files with 132 additions and 65 deletions
@@ -394,8 +394,10 @@ export function ParcelSyncModule() {
qualityBreakdown: {
withCadRef: number;
withPaperCad: number;
withPaperCf: number;
withPaperLb: number;
withLandbook: number;
withArea: number;
withActiveStatus: number;
useful: number;
empty: number;
};
@@ -704,8 +706,10 @@ export function ParcelSyncModule() {
const emptyQuality = {
withCadRef: 0,
withPaperCad: 0,
withPaperCf: 0,
withPaperLb: 0,
withLandbook: 0,
withArea: 0,
withActiveStatus: 0,
useful: 0,
empty: 0,
};
@@ -745,8 +749,10 @@ export function ParcelSyncModule() {
qualityBreakdown: {
withCadRef: Number(qb.withCadRef ?? 0),
withPaperCad: Number(qb.withPaperCad ?? 0),
withPaperCf: Number(qb.withPaperCf ?? 0),
withPaperLb: Number(qb.withPaperLb ?? 0),
withLandbook: Number(qb.withLandbook ?? 0),
withArea: Number(qb.withArea ?? 0),
withActiveStatus: Number(qb.withActiveStatus ?? 0),
useful: Number(qb.useful ?? 0),
empty: Number(qb.empty ?? 0),
},
@@ -2663,9 +2669,9 @@ export function ParcelSyncModule() {
</span>
</span>
<span>
Cu nr. CF pe hârtie:{" "}
Cu nr. CF/LB:{" "}
<span className="font-medium text-foreground">
{noGeomScan.qualityBreakdown.withPaperCf.toLocaleString(
{noGeomScan.qualityBreakdown.withPaperLb.toLocaleString(
"ro-RO",
)}
</span>
@@ -2686,6 +2692,22 @@ export function ParcelSyncModule() {
)}
</span>
</span>
<span>
Active (status=1):{" "}
<span className="font-medium text-foreground">
{noGeomScan.qualityBreakdown.withActiveStatus.toLocaleString(
"ro-RO",
)}
</span>
</span>
<span>
Cu carte funciară:{" "}
<span className="font-medium text-foreground">
{noGeomScan.qualityBreakdown.withLandbook.toLocaleString(
"ro-RO",
)}
</span>
</span>
</div>
<div className="flex items-center gap-3 text-[11px] pt-0.5 border-t border-muted-foreground/10">
<span>
@@ -2698,7 +2720,7 @@ export function ParcelSyncModule() {
</span>
{noGeomScan.qualityBreakdown.empty > 0 && (
<span>
Fără date identificare:{" "}
Filtrate (inactive/fără date):{" "}
<span className="font-semibold text-rose-600 dark:text-rose-400">
{noGeomScan.qualityBreakdown.empty.toLocaleString(
"ro-RO",
@@ -2712,7 +2734,7 @@ export function ParcelSyncModule() {
{includeNoGeom && (
<p className="text-[11px] text-muted-foreground ml-7">
{noGeomScan.qualityBreakdown.empty > 0
? `Din ${noGeomScan.noGeomCount.toLocaleString("ro-RO")} fără geometrie, ~${noGeomScan.qualityBreakdown.useful.toLocaleString("ro-RO")} vor fi importate (cele cu identificare sau suprafață). ${noGeomScan.qualityBreakdown.empty.toLocaleString("ro-RO")} fără nicio dată de identificare vor fi filtrate.`
? `Din ${noGeomScan.noGeomCount.toLocaleString("ro-RO")} fără geometrie, ~${noGeomScan.qualityBreakdown.useful.toLocaleString("ro-RO")} vor fi importate (active, cu identificare sau suprafață). ${noGeomScan.qualityBreakdown.empty.toLocaleString("ro-RO")} vor fi filtrate (inactive sau fără date).`
: "Vor fi importate în DB și incluse în CSV + Magic GPKG (coloana HAS_GEOMETRY=0/1)."}{" "}
În GPKG de bază apar doar cele cu geometrie.
</p>