Skip to content

Refactor createAdresaCompleta placement for consistency across all counties #380

@sebiboga

Description

@sebiboga

Problem Description

The pattern for createAdresaCompleta() placement in the PHP data files is inconsistent across counties, leading to missing adresaCompleta fields in API responses.

Correct Pattern (used in ARGES)

createMunicipiu("NAME", [localities], createAdresaCompleta("municipiul NAME..."))
createOras("NAME", [localities], createAdresaCompleta("orasul NAME..."))
createComuna("NAME", [localities], createAdresaCompleta("comuna NAME..."))

Incorrect Pattern (found in BOTOSANI)

createMunicipiu("NAME", [createAdresaCompleta("..."), ...localities...])

The createAdresaCompleta() is passed as part of the $locuri array instead of as the 3rd parameter.

Root Cause

The functions createMunicipiu(), createOras(), and createComuna() in functions.php only set adresaCompleta if it's passed as the 3rd parameter:

function createMunicipiu($nume, $locuri = [], $adresaCompleta = null) {
    $municipiu = new stdClass();
    $municipiu->nume = $nume;
    if (!empty($locuri)) {
        $municipiu->localitate = $locuri;
    }
    if ($adresaCompleta !== null) {  // Only sets if 3rd param provided
        $municipiu->adresaCompleta = $adresaCompleta;
    }
    return $municipiu;
}

Affected Counties

Need to audit all county data files to ensure consistent pattern:

Task List

  • Audit all county PHP files for incorrect pattern
  • Fix any other counties with the same issue
  • Add test to prevent regression

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions