forked from science-ation/science-ation
Fix the downloaded prize array for awards with >1 prize. For STO this
actually doesn't matter there's only one prize for each award.
This commit is contained in:
parent
1ab43fef68
commit
71509f3f16
@ -37,12 +37,20 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
if(count($array[$k]) == 1) {
|
||||
$array[$k] = $array[$k][0];
|
||||
} else {
|
||||
/* Leave it alone */
|
||||
/* Special cases, leave these as arrays of entries */
|
||||
if($k == 'award' || $k == 'prize') {
|
||||
foreach($array[$k] as &$a) {
|
||||
xml_dearray($a);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if(count($array[$k]) != 1) {
|
||||
echo "Unexpected multielement array, stop.";
|
||||
exit;
|
||||
};
|
||||
$array[$k] = $array[$k][0];
|
||||
|
||||
if(is_array($array[$k])) {
|
||||
xml_dearray($array[$k]);
|
||||
}
|
||||
@ -116,11 +124,9 @@
|
||||
|
||||
/* Undo variable to array */
|
||||
$ret['awards'] = $ret['awards']['award'];
|
||||
foreach($ret['awards'] as &$a)
|
||||
$a['prizes'] = $a['prizes']['prize'];
|
||||
|
||||
/* Turn the awards into an array if it was dearrayed (in the case there is only one */
|
||||
if(!is_array($ret['awards'])) {
|
||||
$ret['awards'] = array($ret['awards']);
|
||||
}
|
||||
$ret['error'] = 0;
|
||||
$ret['message'] = '';
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user