fixed poll parsing
This commit is contained in:
parent
5d009163f0
commit
56078fabad
@ -521,27 +521,21 @@ class APnutI
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$polls = [];
|
$polls = [];
|
||||||
$this->logger->debug('Parsing ' . count($response) . 'results');
|
$this->logger->debug('Parsing ' . count($response) . ' results');
|
||||||
foreach ($response as $post) {
|
foreach ($response as $post) {
|
||||||
if (!empty($post['raw'])) {
|
if (!empty($post['raw'])) {
|
||||||
foreach ($post['raw'] as $raw) {
|
foreach ($post['raw'] as $raw_type => $raw) {
|
||||||
if (!empty($raw[Poll::$notice_type])) {
|
if ($raw_type === Poll::$notice_type) {
|
||||||
try {
|
try {
|
||||||
$this->logger->debug('Parsing poll from raw');
|
$this->logger->debug('Parsing poll from raw', $raw);
|
||||||
$polls[] = new Poll($raw, $this);
|
/*$data = ['raw' => [
|
||||||
|
Poll::$notice_type => $raw
|
||||||
|
]];*/
|
||||||
|
$polls[] = new Poll($post, $this);
|
||||||
} catch (NotSupportedPollException) {
|
} catch (NotSupportedPollException) {
|
||||||
$this->logger->warning('Parsing poll from raw failed. Loading from poll id');
|
$this->logger->warning('Parsing poll from raw failed. Loading from poll id');
|
||||||
$polls[] = $this->getPoll($raw[Poll::$notice_type]['poll_id']);
|
$polls[] = $this->getPoll($raw[Poll::$notice_type]['poll_id']);
|
||||||
}
|
}
|
||||||
// if (empty($raw[Poll::$notice_type]['prompt'])) {
|
|
||||||
// $polls[] = $this->getPoll($raw[Poll::$notice_type]['poll_id']);
|
|
||||||
// } else {
|
|
||||||
// /*$poll_parsing_data = [
|
|
||||||
// 'type' => Poll::$notice_type,
|
|
||||||
// 'value' => $raw[Poll::$notice_type]
|
|
||||||
// ];*/
|
|
||||||
// $polls[] = new Poll($raw, $this);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user