Fix weird pass-by-reference bug.

This commit is contained in:
Kim Taylor
2024-09-25 21:37:50 +10:00
parent 3708a694ed
commit abb4f5675c

View File

@@ -39,7 +39,7 @@ foreach ($config_files as $config_file) {
match_lga($candidate_data, $lga_list);
/* Calculate score for candidate */
foreach ($candidate_data as &$candidate) {
foreach ($candidate_data as $key => $candidate) {
$score = 0;
if ($candidate['Pledge'] === "y") $score++;
@@ -48,7 +48,7 @@ foreach ($candidate_data as &$candidate) {
if ($candidate['q4'] === "Yes") $score++;
if ($candidate['q7'] === "Yes") $score++;
$candidate['Score'] = $score;
$candidate_data[$key]['Score'] = $score;
}
$header = ["Ward", "Candidate Name", "Rating", "Pledge", "Picture"];