Calculate scores based on Faith's criteria.
This commit is contained in:
31
csv-generic/gen-generic.php
Normal file
31
csv-generic/gen-generic.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once("parse_generic_csv.php");
|
||||
|
||||
$options = getopt("", ["generic-csv:"]);
|
||||
|
||||
if (isset($options['generic-csv'])) {
|
||||
$generic_csv = $options['generic-csv'];
|
||||
} else {
|
||||
error_log("Error: Missing required option '--generic-csv'.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$candidate_data = parse_generic_csv($generic_csv);
|
||||
|
||||
/* Calculate score for candidate */
|
||||
foreach ($candidate_data as &$candidate) {
|
||||
$score = 0;
|
||||
|
||||
if ($candidate['Pledge'] === "Yes") $score++;
|
||||
if ($candidate['q1'] === "Yes") $score++;
|
||||
if ($candidate['q3'] === "Yes") $score++;
|
||||
if ($candidate['q4'] === "Yes") $score++;
|
||||
if ($candidate['q7'] === "Yes") $score++;
|
||||
|
||||
$candidate['Score'] = $score;
|
||||
}
|
||||
|
||||
print_r($candidate_data);
|
||||
|
||||
exit(0);
|
||||
Reference in New Issue
Block a user