Update date generic form parser for federal 2025 form.

This commit is contained in:
Kim Taylor
2025-03-30 23:02:48 +11:00
parent 05b0898979
commit 675058201a
4 changed files with 19 additions and 25 deletions

View File

@@ -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'],