Remove duplicate entries, case-insensitive ward name matches and better override system.

This commit is contained in:
Kim Taylor
2024-10-03 23:01:50 +10:00
parent 6eef04e89f
commit abf5147c79
2 changed files with 26 additions and 6 deletions

View File

@@ -61,6 +61,8 @@ foreach ($lga_list as $lga) {
if (count($lga_candidates) === 0) continue;
remove_duplicates($lga_candidates);
$dir = dirname($lga['config-file']);
$dir_files = scandir($dir);
$output_file = $dir."/candidates-generic.csv";
@@ -118,11 +120,10 @@ foreach ($lga_list as $lga) {
foreach ($overrides as $override) {
foreach ($lines as $line_key => $line) {
foreach ($header as $index => $field) {
if (($override['Field'] === $field) &&
($line[$index] === $override['Old'])) {
$lines[$line_key][$index] = $override['New'];
}
$match_index = array_search($override['Match Field'], $header);
$replace_index = array_search($override['Replace Field'], $header);
if ($line[$match_index] === $override['Match Value']) {
$lines[$line_key][$replace_index] = $override['Replace Value'];
}
}
}