Merge pull request 'Feature/hide slides' (#55) from feature/hide-slides into main
Reviewed-on: #55
This commit was merged in pull request #55.
This commit is contained in:
commit
aefaaba086
16 files changed
+546
-39
No files matched your search
@@ -83,7 +83,8 @@ class PollStateService
|
||||
public function forPresenter(Poll $poll): array
|
||||
{
|
||||
$this->Polls->pauseIfEmbedStale($poll);
|
||||
$slides = $this->Slides->listForPoll($poll->id);
|
||||
// The presentation consists of the visible slides only.
|
||||
$slides = $this->Slides->listForPoll($poll->id, true);
|
||||
$current = null;
|
||||
$index = null;
|
||||
foreach ($slides as $i => $slide) {
|
||||
@@ -102,6 +103,7 @@ class PollStateService
|
||||
], $slides),
|
||||
'index' => $index,
|
||||
'count' => count($slides),
|
||||
'hiddenCount' => $this->Slides->find()->where(['poll_id' => $poll->id, 'is_hidden' => true])->count(),
|
||||
'slide' => $current ? $this->slidePayload($current) : null,
|
||||
'results' => $current ? $this->results->forSlide($current) : null,
|
||||
];
|
||||
@@ -123,6 +125,7 @@ class PollStateService
|
||||
return [
|
||||
'poll' => $this->pollPayload($poll),
|
||||
'isLive' => $poll->current_slide_id === $slide->id,
|
||||
'isHidden' => $slide->is_hidden,
|
||||
'index' => null,
|
||||
'count' => null,
|
||||
'slide' => $this->slidePayload($slide),
|
||||
|
||||
@@ -16,7 +16,7 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
||||
* screen. With $includeInternal it also contains their answers, distribution and comments –
|
||||
* that version is meant for the poll owner only.
|
||||
*
|
||||
* Per slide: ['slide' => Slide, 'number' => int (position in the poll, 1-based),
|
||||
* Per slide: ['slide' => Slide, 'number' => int (position in the presentation, 1-based; hidden slides are left out),
|
||||
* 'internal' => bool (private slide), 'withheld' => bool (private and left out),
|
||||
* 'results' => ResultsService::forSlide() shape, where
|
||||
* open: 'answers' contains all texts (not only the newest ones), and
|
||||
@@ -49,7 +49,7 @@ class ReportService
|
||||
*/
|
||||
public function build(Poll $poll, bool $includeInternal): array
|
||||
{
|
||||
$slides = $this->Slides->listForPoll($poll->id);
|
||||
$slides = $this->Slides->listForPoll($poll->id, true);
|
||||
$includeInternal = $includeInternal
|
||||
&& array_filter($slides, fn(Slide $slide) => $slide->isInteractive() && $slide->isPrivate()) !== [];
|
||||
$sections = [];
|
||||
|
||||
Reference in new issue
Block a user