1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

set id of choice in time slice

This commit is contained in:
Tykayn 2021-04-30 15:49:00 +02:00 committed by tykayn
parent c0791d52ac
commit 5bb76de67a

View File

@ -301,10 +301,10 @@ class Poll {
$grouped_dates[ $boom[ 0 ] ] = [
"date_string" => $boom[ 0 ],
"time_slices" => [],
"choices" => [],
];
}
$grouped_dates[ $boom[ 0 ] ][ "time_slices" ][] = [
$grouped_dates[ $boom[ 0 ] ][ "choices" ][] = [
"choice_id" => $choice->getId(),
"name" => $boom[ 1 ] ];
}
@ -378,12 +378,13 @@ class Poll {
$groupsOfDates = [];
foreach ( $grouped_dates as $group ) {
$ii =0;
foreach ( $group["time_slices"] as $slice ) {
foreach ( $group["choices"] as $slice ) {
$slice['score'] = $computedArray[ $slice['choice_id'] ]['score'];
$slice['yes'] = $computedArray[ $slice['choice_id'] ]['yes'];
$slice['maybe'] = $computedArray[ $slice['choice_id'] ]['maybe'];
$slice['no'] = $computedArray[ $slice['choice_id'] ]['no'];
$group["time_slices"][$ii] = $slice;
$slice['id'] = $slice['choice_id'];
$group["choices"][$ii] = $slice;
$ii++;
}