Update homepage pledge image rotation for federal.
This commit is contained in:
@@ -15,11 +15,11 @@ $candidate_data = parse_pledge_data(explode(" ", $candidates_files), null);
|
|||||||
|
|
||||||
/* Select people who have taken the pledge (and have an image) */
|
/* Select people who have taken the pledge (and have an image) */
|
||||||
$pledgeCandidates = array_filter($candidate_data, function ($candidate) {
|
$pledgeCandidates = array_filter($candidate_data, function ($candidate) {
|
||||||
return $candidate['Pledge'] === 'y' && $candidate['Picture'] !== "";
|
return $candidate['Pledge'] === 'Yes' && $candidate['Picture'] !== "";
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Select 9 random candidates */
|
/* Select 9 random candidates */
|
||||||
$pledgeKeys = array_rand($pledgeCandidates, 9);
|
$pledgeKeys = array_rand($pledgeCandidates, min(count($pledgeCandidates), 9));
|
||||||
shuffle($pledgeKeys);
|
shuffle($pledgeKeys);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ function parse_pledge_data($candidates_files, $default_image) {
|
|||||||
if (!empty($elected_data) && array_key_exists($name_slug, $elected_data)) {
|
if (!empty($elected_data) && array_key_exists($name_slug, $elected_data)) {
|
||||||
$candidate['Elected'] = $elected_data[$name_slug]['Elected'];
|
$candidate['Elected'] = $elected_data[$name_slug]['Elected'];
|
||||||
}
|
}
|
||||||
$candidate['Council'] = $config['councilName'];
|
$candidate['Council'] = $config['divisionName'];
|
||||||
$candidate['Path'] = dirname($file);
|
$candidate['Path'] = dirname($file);
|
||||||
$media_desc = $candidate['Path']."/".
|
$media_desc = $candidate['Path']."/".
|
||||||
$candidate['Picture'].".json";
|
$candidate['Picture'].".json";
|
||||||
|
|||||||
Reference in New Issue
Block a user