Use default image for candidates who have signed the ledge, but not provided an image.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
require_once("parse_pledge_data.php");
|
||||
require_once("page_renderer.php");
|
||||
|
||||
$options = getopt("", ["candidates-files:"]);
|
||||
$options = getopt("", ["candidates-files:", "default-image:"]);
|
||||
|
||||
if (isset($options['candidates-files'])) {
|
||||
$candidates_files = $options['candidates-files'];
|
||||
@@ -12,7 +12,23 @@ if (isset($options['candidates-files'])) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$candidate_data = parse_pledge_data(explode(" ", $candidates_files));
|
||||
if (isset($options['default-image'])) {
|
||||
$default_image = $options['default-image'];
|
||||
} else {
|
||||
error_log("Error: Missing required option '--default-image'.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$default_image = file_get_contents($default_image);
|
||||
|
||||
if ($default_image !== FALSE) {
|
||||
$default_image = json_decode($default_image, true);
|
||||
} else {
|
||||
error_log("Error opening config.json.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$candidate_data = parse_pledge_data(explode(" ", $candidates_files), $default_image);
|
||||
|
||||
/* Select people who have taken the pledge */
|
||||
$pledgeCandidates = array_filter($candidate_data, function ($candidate) {
|
||||
|
||||
Reference in New Issue
Block a user