mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
save kind of poll
This commit is contained in:
parent
e86606b543
commit
cc74a08603
@ -216,6 +216,7 @@ class PollController extends EmailsController {
|
||||
$newpoll
|
||||
->setModificationPolicy( $data[ 'modification_policy' ] )
|
||||
->setTitle( $data[ 'title' ] )
|
||||
->setKind( $data[ 'kind' ] )
|
||||
->setCustomUrl( $data[ 'custom_url' ] );
|
||||
if ( count( $data[ 'allowed_answers' ] ) ) {
|
||||
$newpoll->setAllowedAnswers( $data[ 'allowed_answers' ] );
|
||||
@ -257,7 +258,7 @@ class PollController extends EmailsController {
|
||||
$newpoll->setDescription( $data['description'] );
|
||||
$newpoll->setHideResults( false );
|
||||
// possible answers
|
||||
$newpoll->setAllowedAnswers( [ 'yes' ] );
|
||||
$newpoll->setAllowedAnswers( $data[ 'allowed_answers' ] );
|
||||
$newpoll->setVotesMax( $data[ 'maxCountOfAnswers' ] );
|
||||
$newpoll->setCommentsAllowed( $data['allowComments'] );
|
||||
|
||||
|
@ -308,7 +308,8 @@ class Poll {
|
||||
}
|
||||
$grouped_dates[ $boom[ 0 ] ][ "choices" ][] = [
|
||||
"choice_id" => $choice->getId(),
|
||||
"name" => $boom[ 1 ] ];
|
||||
"name" => $boom[ 1 ],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -494,7 +495,11 @@ class Poll {
|
||||
}
|
||||
|
||||
public function setAllowedAnswers( array $allowedAnswers ): self {
|
||||
if ( ! count( $allowedAnswers ) ) {
|
||||
$this->allowedAnswers = [ 'yes' ];
|
||||
} else {
|
||||
$this->allowedAnswers = $allowedAnswers;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user