Remove duplicate entries, case-insensitive ward name matches and better override system.
This commit is contained in:
@@ -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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user