Add Q&A slide type
Participants submit questions, upvote them and the presenter discusses them one by one, most upvoted first. - Stages collect -> vote -> discuss, switched manually by the presenter (V key or stepper, going back is possible) - Configurable upvote budget per participant, freely distributable (several upvotes on one question are allowed), votes can be withdrawn - Participants see all questions while collecting to avoid duplicates; no counts before the discussion - While discussing, next/prev step through the questions before moving to the next slide - Migration: slides.stage, slides.focus_response_id, responses.parent_id Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ea944b080f
commit
f0c6687100
21 files changed
+1327
-27
No files matched your search
@@ -8,6 +8,7 @@ use Cake\ORM\Entity;
|
||||
/**
|
||||
* One answer row of a participant. A multi-select vote or a word cloud entry
|
||||
* with several words results in several rows with the same participant_hash.
|
||||
* Q&A: a question is a row with text_value, an upvote a row with parent_id = question id.
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $slide_id
|
||||
@@ -15,6 +16,7 @@ use Cake\ORM\Entity;
|
||||
* @property int|null $slide_option_id
|
||||
* @property string|null $text_value
|
||||
* @property int|null $numeric_value
|
||||
* @property int|null $parent_id Q&A upvote: id of the supported question
|
||||
* @property \Cake\I18n\DateTime $created
|
||||
*/
|
||||
class Response extends Entity
|
||||
@@ -30,6 +32,7 @@ class Response extends Entity
|
||||
'slide_option_id' => true,
|
||||
'text_value' => true,
|
||||
'numeric_value' => true,
|
||||
'parent_id' => true,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,8 @@ use Cake\ORM\Entity;
|
||||
* @property bool $is_voting_open
|
||||
* @property \Cake\I18n\DateTime|null $voting_started_at Quiz: start of the voting window
|
||||
* @property \Cake\I18n\DateTime|null $voting_ends_at Quiz: deadline (null = closed manually)
|
||||
* @property string|null $stage Q&A: collect|vote|discuss (null = collect), see qaStage()
|
||||
* @property int|null $focus_response_id Q&A: question currently being discussed
|
||||
* @property \Cake\I18n\DateTime $created
|
||||
* @property \Cake\I18n\DateTime $modified
|
||||
* @property \App\Model\Entity\Poll $poll
|
||||
@@ -36,6 +38,7 @@ class Slide extends Entity
|
||||
public const TYPE_CONTENT = 'content';
|
||||
public const TYPE_QUIZ = 'quiz';
|
||||
public const TYPE_YOUTUBE = 'youtube';
|
||||
public const TYPE_QA = 'qa';
|
||||
|
||||
/**
|
||||
* Quiz phases, see quizPhase().
|
||||
@@ -51,6 +54,24 @@ class Slide extends Entity
|
||||
*/
|
||||
public const QUIZ_TIME_LIMITS = [0, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300];
|
||||
|
||||
/**
|
||||
* Q&A stages, see qaStage(): participants submit questions, then upvote
|
||||
* them, then the presenter discusses them one by one (most upvoted first).
|
||||
*/
|
||||
public const QA_COLLECT = 'collect';
|
||||
public const QA_VOTE = 'vote';
|
||||
public const QA_DISCUSS = 'discuss';
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
public const QA_STAGES = [self::QA_COLLECT, self::QA_VOTE, self::QA_DISCUSS];
|
||||
|
||||
/**
|
||||
* Highest selectable number of upvotes per participant on a Q&A slide.
|
||||
*/
|
||||
public const QA_MAX_UPVOTES = 10;
|
||||
|
||||
/**
|
||||
* Default settings per type. Unknown keys are dropped on save.
|
||||
*
|
||||
@@ -67,6 +88,8 @@ class Slide extends Entity
|
||||
self::TYPE_QUIZ => ['time_limit' => 30],
|
||||
// url as entered, video_id parsed from it, start in seconds
|
||||
self::TYPE_YOUTUBE => ['url' => '', 'video_id' => '', 'start' => 0, 'autoplay' => false],
|
||||
// upvotes per participant in the voting stage (1..QA_MAX_UPVOTES)
|
||||
self::TYPE_QA => ['max_upvotes' => 3],
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -91,6 +114,7 @@ class Slide extends Entity
|
||||
self::TYPE_OPEN => __('Offene Frage'),
|
||||
self::TYPE_SCALE => __('Skala'),
|
||||
self::TYPE_QUIZ => __('Quiz'),
|
||||
self::TYPE_QA => __('Fragen & Antworten'),
|
||||
self::TYPE_CONTENT => __('Inhaltsfolie'),
|
||||
self::TYPE_YOUTUBE => __('YouTube-Video'),
|
||||
];
|
||||
@@ -107,6 +131,7 @@ class Slide extends Entity
|
||||
self::TYPE_OPEN => __('Freitext-Antworten, live als Liste.'),
|
||||
self::TYPE_SCALE => __('Bewertung auf einer Skala, z. B. 1 bis 5.'),
|
||||
self::TYPE_QUIZ => __('Frage mit richtiger Antwort und Zeitlimit, aufgelöst wird erst am Ende.'),
|
||||
self::TYPE_QA => __('Teilnehmende reichen Fragen ein und wählen per Upvote, welche zuerst beantwortet werden.'),
|
||||
self::TYPE_CONTENT => __('Nur Text anzeigen, ohne Abstimmung.'),
|
||||
self::TYPE_YOUTUBE => __('Video in der Präsentation abspielen, Teilnehmende bekommen den Link zum Teilen.'),
|
||||
];
|
||||
@@ -199,6 +224,35 @@ class Slide extends Entity
|
||||
return $this->type === self::TYPE_QUIZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isQa(): bool
|
||||
{
|
||||
return $this->type === self::TYPE_QA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage of a Q&A slide (one of the QA_* constants), see QaService.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function qaStage(): string
|
||||
{
|
||||
return in_array($this->stage, self::QA_STAGES, true) ? (string)$this->stage : self::QA_COLLECT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a participant may answer the slide several times (word cloud: one
|
||||
* row per word, Q&A: questions and upvotes).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function allowsMultipleResponses(): bool
|
||||
{
|
||||
return in_array($this->type, [self::TYPE_WORDCLOUD, self::TYPE_QA], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Phase of a quiz: ready (not started yet), running, finished (time up or
|
||||
* closed by the presenter). Results and correct answers are only revealed
|
||||
|
||||
Reference in new issue
Block a user