Update date generic form parser for federal 2025 form.
This commit is contained in:
@@ -42,21 +42,22 @@ match_lga($candidate_data, $lga_list);
|
||||
foreach ($candidate_data as $key => $candidate) {
|
||||
$score = 0;
|
||||
|
||||
if ($candidate['Pledge'] === "y") $score++;
|
||||
if ($candidate['q0'] === "Yes") $score++;
|
||||
if ($candidate['q1'] === "Yes") $score++;
|
||||
if ($candidate['q2'] === "Yes") $score++;
|
||||
if ($candidate['q3'] === "Yes") $score++;
|
||||
if ($candidate['q4'] === "Yes") $score++;
|
||||
if ($candidate['q7'] === "Yes") $score++;
|
||||
|
||||
$candidate_data[$key]['Score'] = $score;
|
||||
$candidate_data[$key]['Pledge'] = $score > 0 ? "Yes" : "No";
|
||||
}
|
||||
|
||||
$header = ["Ward", "Candidate Name", "Rating", "Pledge", "Picture"];
|
||||
$header = ["Candidate Name", "Rating", "Pledge", "Picture"];
|
||||
|
||||
/* Generate candidates-generic.csv */
|
||||
foreach ($lga_list as $lga) {
|
||||
$lga_candidates = array_filter($candidate_data, function ($candidate) use ($lga) {
|
||||
return $candidate['match_lga'] === $lga['slug'];
|
||||
return $candidate['match_division'] === $lga['slug'];
|
||||
});
|
||||
|
||||
if (count($lga_candidates) === 0) continue;
|
||||
@@ -91,7 +92,6 @@ foreach ($lga_list as $lga) {
|
||||
}
|
||||
|
||||
$lines[] = [
|
||||
$candidate['match_ward'],
|
||||
$candidate['Name'],
|
||||
$candidate['Score'],
|
||||
$candidate['Pledge'],
|
||||
|
||||
Reference in New Issue
Block a user