Fix weird pass-by-reference bug.
This commit is contained in:
@@ -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"];
|
||||
|
||||
Reference in New Issue
Block a user