Drop the comment interval setting #40
No files matched your search
@@ -200,9 +200,8 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
|
|||||||
- **Skala-Kommentare** (Setting `comments`, `Slide::hasComments()`): optionales Feld `comment`, gespeichert als `text_value`
|
- **Skala-Kommentare** (Setting `comments`, `Slide::hasComments()`): optionales Feld `comment`, gespeichert als `text_value`
|
||||||
in derselben Zeile wie `numeric_value` (ohne Setting wird es ignoriert). Öffentliche Skalen liefern im Presenter-/Embed-State
|
in derselben Zeile wie `numeric_value` (ohne Setting wird es ignoriert). Öffentliche Skalen liefern im Presenter-/Embed-State
|
||||||
`results.comments` (Teilnehmende bekommen sie nie: Skalen liefern ihnen grundsätzlich keine `results`, siehe `PollStateService::forParticipant()`)
|
`results.comments` (Teilnehmende bekommen sie nie: Skalen liefern ihnen grundsätzlich keine `results`, siehe `PollStateService::forParticipant()`)
|
||||||
(älteste zuerst, je `id`, `text`, `value` – `value` nur mit Setting `comment_ratings`, sonst `null`); `Comments` in `plenario.js` blättert sie automatisch durch (Sekunden pro Kommentar = Setting `comment_interval`, Auswahl
|
(älteste zuerst, je `id`, `text`, `value` – `value` nur mit Setting `comment_ratings`, sonst `null`); `Comments` in `plenario.js` blättert sie automatisch durch (Anzeigedauer nur nach Textlänge, bewusst ohne Setting:
|
||||||
`Slide::COMMENT_INTERVALS`, im State als `results.commentInterval`; Standard `Slide::COMMENT_INTERVAL_AUTO` (0) = Lesezeit je nach
|
`Comments.delay()` = 2,5 s + 15 Zeichen/s, 5–30 s; Vor/Zurück/Fortsetzen geben dem Kommentar wieder die volle Zeit; „Kommentar X von N“,
|
||||||
Textlänge, `Comments.delay()`: 2,5 s + 15 Zeichen/s, 5–30 s; Vor/Zurück/Fortsetzen geben dem Kommentar wieder die volle Zeit; „Kommentar X von N“,
|
|
||||||
vor/zurück/Pause, Zustand übersteht das Neu-Rendern beim Polling). Bei internem Feedback erscheinen sie erst,
|
vor/zurück/Pause, Zustand übersteht das Neu-Rendern beim Polling). Bei internem Feedback erscheinen sie erst,
|
||||||
wenn der Presenter die Ergebnisse einblendet.
|
wenn der Presenter die Ergebnisse einblendet.
|
||||||
|
|
||||||
|
|||||||
@@ -55,20 +55,6 @@ class Slide extends Entity
|
|||||||
*/
|
*/
|
||||||
public const QUIZ_TIME_LIMITS = [0, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300];
|
public const QUIZ_TIME_LIMITS = [0, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300];
|
||||||
|
|
||||||
/**
|
|
||||||
* Comment interval "automatic": the presentation derives the time per comment
|
|
||||||
* from its length (reading speed), see `Comments.delay()` in plenario.js.
|
|
||||||
*/
|
|
||||||
public const COMMENT_INTERVAL_AUTO = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Selectable seconds per comment when the comments of a scale rotate in the presentation
|
|
||||||
* (COMMENT_INTERVAL_AUTO = depending on the length of each comment).
|
|
||||||
*
|
|
||||||
* @var list<int>
|
|
||||||
*/
|
|
||||||
public const COMMENT_INTERVALS = [self::COMMENT_INTERVAL_AUTO, 3, 5, 8, 10, 15, 20, 30, 45, 60];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Q&A stages, see qaStage(): participants submit questions, then upvote
|
* Q&A stages, see qaStage(): participants submit questions, then upvote
|
||||||
* them, then the presenter discusses them one by one (most upvoted first).
|
* them, then the presenter discusses them one by one (most upvoted first).
|
||||||
@@ -101,10 +87,10 @@ class Slide extends Entity
|
|||||||
// private: internal feedback, ratings only visible in the admin area (never on the stage)
|
// private: internal feedback, ratings only visible in the admin area (never on the stage)
|
||||||
// comments: optional comment field, comments rotate in the presentation (unless private)
|
// comments: optional comment field, comments rotate in the presentation (unless private)
|
||||||
// comment_ratings: show the rating next to each comment in the presentation
|
// comment_ratings: show the rating next to each comment in the presentation
|
||||||
// comment_interval: seconds per comment while they rotate (one of COMMENT_INTERVALS, 0 = by length)
|
// (time per comment depends on its length, see Comments.delay() in plenario.js)
|
||||||
self::TYPE_SCALE => [
|
self::TYPE_SCALE => [
|
||||||
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false,
|
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false,
|
||||||
'comments' => false, 'comment_ratings' => false, 'comment_interval' => self::COMMENT_INTERVAL_AUTO,
|
'comments' => false, 'comment_ratings' => false,
|
||||||
],
|
],
|
||||||
self::TYPE_CONTENT => [],
|
self::TYPE_CONTENT => [],
|
||||||
// time_limit in seconds, 0 = no limit (presenter ends the quiz)
|
// time_limit in seconds, 0 = no limit (presenter ends the quiz)
|
||||||
|
|||||||
@@ -159,10 +159,6 @@ class SlidesTable extends Table
|
|||||||
$settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||||
$settings['comments'] = filter_var($input['comments'] ?? 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['comment_ratings'] = filter_var($input['comment_ratings'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||||
$interval = (int)($input['comment_interval'] ?? $settings['comment_interval']);
|
|
||||||
if (in_array($interval, Slide::COMMENT_INTERVALS, true)) {
|
|
||||||
$settings['comment_interval'] = $interval;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Slide::TYPE_QUIZ:
|
case Slide::TYPE_QUIZ:
|
||||||
$limit = (int)($input['time_limit'] ?? $settings['time_limit']);
|
$limit = (int)($input['time_limit'] ?? $settings['time_limit']);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
|||||||
* 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else [];
|
* 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else [];
|
||||||
* 'value' is null unless the setting comment_ratings is on;
|
* 'value' is null unless the setting comment_ratings is on;
|
||||||
* presentation only: participants never get results of scale slides, see PollStateService);
|
* presentation only: participants never get results of scale slides, see PollStateService);
|
||||||
* 'commentInterval' => int seconds per comment while they rotate, 0 = depending on its length;
|
|
||||||
* open/scale with 'private' (anonymous/internal feedback): contents are included for the
|
* 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;
|
* presenter/embed, which start with the results hidden and may show them on demand;
|
||||||
* participants never get results of these slides, the public PDF strips them (withoutContents())
|
* participants never get results of these slides, the public PDF strips them (withoutContents())
|
||||||
@@ -326,7 +325,6 @@ class ResultsService
|
|||||||
return $this->scaleResults($slide) + [
|
return $this->scaleResults($slide) + [
|
||||||
'private' => $slide->isPrivate(),
|
'private' => $slide->isPrivate(),
|
||||||
'comments' => $comments,
|
'comments' => $comments,
|
||||||
'commentInterval' => (int)$slide->setting('comment_interval'),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,22 +171,7 @@ $optionsError = $slide->getError('options_text');
|
|||||||
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'),
|
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'),
|
||||||
'checked' => (bool)$settings['comments'],
|
'checked' => (bool)$settings['comments'],
|
||||||
]) ?>
|
]) ?>
|
||||||
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden). Bei internem Feedback erst, wenn du die Ergebnisse einblendest.') ?></p>
|
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden), jeder so lange, wie man zum Lesen braucht: kurze etwa 5 Sekunden, lange bis zu 30 Sekunden. Bei internem Feedback erst, wenn du die Ergebnisse einblendest.') ?></p>
|
||||||
<?= $this->Form->control('settings.comment_interval', [
|
|
||||||
'type' => 'select',
|
|
||||||
'options' => array_combine(
|
|
||||||
\App\Model\Entity\Slide::COMMENT_INTERVALS,
|
|
||||||
array_map(
|
|
||||||
fn(int $s) => $s === \App\Model\Entity\Slide::COMMENT_INTERVAL_AUTO
|
|
||||||
? __('automatisch (je nach Länge des Kommentars)')
|
|
||||||
: __n('{0} Sekunde', '{0} Sekunden', $s, $s),
|
|
||||||
\App\Model\Entity\Slide::COMMENT_INTERVALS,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'label' => __('Nächster Kommentar nach'),
|
|
||||||
'value' => $settings['comment_interval'],
|
|
||||||
]) ?>
|
|
||||||
<p class="hint"><?= __('„Automatisch“ lässt jedem Kommentar so viel Zeit, wie man zum Lesen braucht: kurze stehen etwa 5 Sekunden, lange bis zu 30 Sekunden.') ?></p>
|
|
||||||
<?= $this->Form->control('settings.comment_ratings', [
|
<?= $this->Form->control('settings.comment_ratings', [
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Bewertung beim Kommentar in der Präsentation anzeigen'),
|
'label' => __('Bewertung beim Kommentar in der Präsentation anzeigen'),
|
||||||
|
|||||||
@@ -154,33 +154,18 @@ class ScaleCommentsTest extends TestCase
|
|||||||
$this->assertSame([4, 3], array_column($this->presenterResults($token)['comments'], 'value'));
|
$this->assertSame([4, 3], array_column($this->presenterResults($token)['comments'], 'value'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCommentIntervalIsConfigurable(): void
|
public function testCommentIntervalIsNotConfigurable(): void
|
||||||
{
|
{
|
||||||
$auto = Slide::COMMENT_INTERVAL_AUTO;
|
// The presentation times each comment by its length; there is no setting for it.
|
||||||
$this->assertSame($auto, SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, [])['comment_interval']);
|
$settings = SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, ['comment_interval' => '15']);
|
||||||
$this->assertSame(15, SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, ['comment_interval' => '15'])['comment_interval']);
|
$this->assertArrayNotHasKey('comment_interval', $settings);
|
||||||
$this->assertSame($auto, SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, ['comment_interval' => '0'])['comment_interval']);
|
|
||||||
$this->assertSame($auto, SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, ['comment_interval' => '7'])['comment_interval']);
|
|
||||||
$this->assertSame($auto, SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, ['comment_interval' => '-1'])['comment_interval']);
|
|
||||||
|
|
||||||
[, $token] = $this->scaleWithComments(['comment_interval' => 20]);
|
|
||||||
$this->assertSame(20, $this->presenterResults($token)['commentInterval']);
|
|
||||||
|
|
||||||
[, $token] = $this->scaleWithComments();
|
[, $token] = $this->scaleWithComments();
|
||||||
$this->assertSame($auto, $this->presenterResults($token)['commentInterval']);
|
$this->assertArrayNotHasKey('commentInterval', $this->presenterResults($token));
|
||||||
|
|
||||||
$this->get("/admin/$token");
|
|
||||||
$this->assertResponseOk();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFormShowsCommentInterval(): void
|
|
||||||
{
|
|
||||||
[, $token] = $this->createPoll();
|
|
||||||
$this->get("/admin/$token/slides/add?type=scale");
|
$this->get("/admin/$token/slides/add?type=scale");
|
||||||
|
$this->assertResponseOk();
|
||||||
$this->assertResponseContains('name="settings[comment_interval]"');
|
$this->assertResponseNotContains('comment_interval');
|
||||||
$this->assertResponseContains('15 Sekunden');
|
|
||||||
$this->assertResponseContains('automatisch (je nach Länge des Kommentars)');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParticipantsNeverSeeComments(): void
|
public function testParticipantsNeverSeeComments(): void
|
||||||
|
|||||||
+11
-23
@@ -297,7 +297,6 @@
|
|||||||
* so position, pause and timer live here and survive the re-render.
|
* so position, pause and timer live here and survive the re-render.
|
||||||
*/
|
*/
|
||||||
var Comments = {
|
var Comments = {
|
||||||
seconds: 0,
|
|
||||||
key: null,
|
key: null,
|
||||||
index: 0,
|
index: 0,
|
||||||
paused: false,
|
paused: false,
|
||||||
@@ -305,17 +304,16 @@
|
|||||||
items: [],
|
items: [],
|
||||||
node: null,
|
node: null,
|
||||||
|
|
||||||
// Automatic interval: time to read the comment on the stage, within sensible bounds.
|
// Time per comment: enough to read it on the stage, within sensible bounds.
|
||||||
AUTO_BASE_MS: 2500,
|
BASE_MS: 2500,
|
||||||
AUTO_CHARS_PER_SECOND: 15,
|
CHARS_PER_SECOND: 15,
|
||||||
AUTO_MIN_MS: 5000,
|
MIN_MS: 5000,
|
||||||
AUTO_MAX_MS: 30000,
|
MAX_MS: 30000,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} items comments, oldest first
|
* @param {Array} items comments, oldest first
|
||||||
* @param {number} [seconds] time per comment (slide setting), 0 = depending on its length
|
|
||||||
*/
|
*/
|
||||||
render: function (items, seconds) {
|
render: function (items) {
|
||||||
// A different first comment means a different slide (or a reset): start over.
|
// A different first comment means a different slide (or a reset): start over.
|
||||||
var key = String(items[0].id);
|
var key = String(items[0].id);
|
||||||
if (key !== Comments.key) {
|
if (key !== Comments.key) {
|
||||||
@@ -323,13 +321,6 @@
|
|||||||
Comments.index = 0;
|
Comments.index = 0;
|
||||||
Comments.paused = false;
|
Comments.paused = false;
|
||||||
}
|
}
|
||||||
seconds = seconds > 0 ? seconds : 0;
|
|
||||||
if (seconds !== Comments.seconds) {
|
|
||||||
// Setting changed (or another slide): apply it right away.
|
|
||||||
Comments.seconds = seconds;
|
|
||||||
clearTimeout(Comments.timer);
|
|
||||||
Comments.timer = null;
|
|
||||||
}
|
|
||||||
Comments.items = items;
|
Comments.items = items;
|
||||||
Comments.index = Math.min(Comments.index, items.length - 1);
|
Comments.index = Math.min(Comments.index, items.length - 1);
|
||||||
|
|
||||||
@@ -382,19 +373,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How long a comment stays on the stage: the fixed setting, or (automatic)
|
* How long a comment stays on the stage: a base time plus reading time
|
||||||
* a base time plus reading time for its length, between AUTO_MIN_MS and AUTO_MAX_MS.
|
* for its length, between MIN_MS and MAX_MS.
|
||||||
*
|
*
|
||||||
* @param {Object} item comment
|
* @param {Object} item comment
|
||||||
* @return {number} milliseconds
|
* @return {number} milliseconds
|
||||||
*/
|
*/
|
||||||
delay: function (item) {
|
delay: function (item) {
|
||||||
if (Comments.seconds > 0) {
|
|
||||||
return Comments.seconds * 1000;
|
|
||||||
}
|
|
||||||
var length = item && item.text ? Array.from(item.text).length : 0;
|
var length = item && item.text ? Array.from(item.text).length : 0;
|
||||||
var ms = Comments.AUTO_BASE_MS + length / Comments.AUTO_CHARS_PER_SECOND * 1000;
|
var ms = Comments.BASE_MS + length / Comments.CHARS_PER_SECOND * 1000;
|
||||||
return Math.round(Math.min(Comments.AUTO_MAX_MS, Math.max(Comments.AUTO_MIN_MS, ms)));
|
return Math.round(Math.min(Comments.MAX_MS, Math.max(Comments.MIN_MS, ms)));
|
||||||
},
|
},
|
||||||
|
|
||||||
/** (Re)start the countdown for the comment currently shown. */
|
/** (Re)start the countdown for the comment currently shown. */
|
||||||
@@ -553,7 +541,7 @@
|
|||||||
]),
|
]),
|
||||||
gauge
|
gauge
|
||||||
]);
|
]);
|
||||||
var comments = results.comments && results.comments.length ? Comments.render(results.comments, results.commentInterval) : null;
|
var comments = results.comments && results.comments.length ? Comments.render(results.comments) : null;
|
||||||
return el('div', { class: 'scale-results' }, [average, columns, labels, comments]);
|
return el('div', { class: 'scale-results' }, [average, columns, labels, comments]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user