Show scale results as average next to a donut chart
Average and distribution now sit side by side: a big average figure with its gauge or stars, and the distribution as a donut (CSS conic-gradient, shades of one colour, legend with percent and count). A single dropdown setting scale_view (both, average only, chart only) replaces the two checkboxes; a single part is centred. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bf16ac0d3b
commit
b3c80ab79f
8 files changed
+185
-192
No files matched your search
@@ -61,6 +61,14 @@ class Slide extends Entity
|
||||
public const SCALE_NUMBERS = 'numbers';
|
||||
public const SCALE_STARS = 'stars';
|
||||
|
||||
/**
|
||||
* What a scale shows in the presentation: average and distribution (chart), or only one of them.
|
||||
*/
|
||||
public const SCALE_VIEW_BOTH = 'both';
|
||||
public const SCALE_VIEW_AVERAGE = 'average';
|
||||
public const SCALE_VIEW_CHART = 'chart';
|
||||
public const SCALE_VIEWS = [self::SCALE_VIEW_BOTH, self::SCALE_VIEW_AVERAGE, self::SCALE_VIEW_CHART];
|
||||
|
||||
/**
|
||||
* Q&A stages, see qaStage(): participants submit questions, then upvote
|
||||
* them, then the presenter discusses them one by one (most upvoted first).
|
||||
@@ -95,13 +103,13 @@ class Slide extends Entity
|
||||
// comment_ratings: show the rating next to each comment in the presentation
|
||||
// (time per comment depends on its length, see Comments.delay() in plenario.js)
|
||||
// style: numbers or stars (SCALE_*), stars always start at scale_min = 1
|
||||
// show_average / show_distribution: parts of the result shown in the presentation (presenter/embed);
|
||||
// scale_view: parts of the result shown in the presentation (presenter/embed, SCALE_VIEWS);
|
||||
// the evaluation in the admin area and the PDF export always contain both
|
||||
self::TYPE_SCALE => [
|
||||
'style' => self::SCALE_NUMBERS,
|
||||
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false,
|
||||
'comments' => false, 'comment_ratings' => false,
|
||||
'show_average' => true, 'show_distribution' => true,
|
||||
'scale_view' => self::SCALE_VIEW_BOTH,
|
||||
],
|
||||
self::TYPE_CONTENT => [],
|
||||
// time_limit in seconds, 0 = no limit (presenter ends the quiz)
|
||||
|
||||
@@ -162,8 +162,8 @@ class SlidesTable extends Table
|
||||
$settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$settings['comments'] = filter_var($input['comments'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$settings['comment_ratings'] = filter_var($input['comment_ratings'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$settings['show_average'] = filter_var($input['show_average'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
||||
$settings['show_distribution'] = filter_var($input['show_distribution'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
||||
$view = $input['scale_view'] ?? null;
|
||||
$settings['scale_view'] = in_array($view, Slide::SCALE_VIEWS, true) ? $view : Slide::SCALE_VIEW_BOTH;
|
||||
break;
|
||||
case Slide::TYPE_QUIZ:
|
||||
$limit = (int)($input['time_limit'] ?? $settings['time_limit']);
|
||||
|
||||
@@ -21,8 +21,8 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
||||
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool), 'stars' (bool: star rating, min = 1);
|
||||
* 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else [];
|
||||
* 'value' is null unless the setting comment_ratings is on;
|
||||
* 'showAverage', 'showDistribution' (bool): parts shown in the presentation (settings
|
||||
* show_average/show_distribution, the data is always complete);
|
||||
* 'view' (both|average|chart): parts shown in the presentation (setting scale_view,
|
||||
* the data is always complete);
|
||||
* presentation only: participants never get results of scale slides, see PollStateService);
|
||||
* open/scale with 'private' (anonymous/internal feedback): contents are included for the
|
||||
* presenter/embed, which start with the results hidden and may show them on demand;
|
||||
@@ -337,8 +337,7 @@ class ResultsService
|
||||
return $this->scaleResults($slide) + [
|
||||
'private' => $slide->isPrivate(),
|
||||
'comments' => $comments,
|
||||
'showAverage' => (bool)$slide->setting('show_average'),
|
||||
'showDistribution' => (bool)$slide->setting('show_distribution'),
|
||||
'view' => $slide->setting('scale_view'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user