Allow Q&A rounds without upvotes and limit upvotes per question
- max_upvotes = 0 disables upvoting: the voting stage is skipped (collect -> discuss), questions are discussed in submission order - new setting max_upvotes_per_question caps a participant's upvotes on a single question (0 = no limit besides max_upvotes) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e44ded107
commit
bc86ec2db6
16 files changed
+235
-38
No files matched your search
@@ -15,7 +15,8 @@ use InvalidArgumentException;
|
||||
* Stages (Slide::qaStage()):
|
||||
* - collect: participants submit questions (voting open)
|
||||
* - vote: participants upvote questions of others (own ones with `allow_self_upvote`),
|
||||
* at most `max_upvotes` each (voting open)
|
||||
* at most `max_upvotes` each and `max_upvotes_per_question` per question (voting open).
|
||||
* Skipped with `max_upvotes` = 0 (Slide::qaStages()).
|
||||
* - discuss: voting closed; the presenter steps through the questions, most upvoted
|
||||
* first (`slides.focus_response_id` = question on screen)
|
||||
*
|
||||
@@ -70,15 +71,15 @@ class QaService
|
||||
/**
|
||||
* Switches the stage. Collecting and voting open the slide for input,
|
||||
* discussing closes it and puts the top question on screen. Setting the
|
||||
* current stage again changes nothing.
|
||||
* current stage again changes nothing. Without upvotes there is no voting stage.
|
||||
*
|
||||
* @param \App\Model\Entity\Slide $slide Q&A slide
|
||||
* @param string $stage One of Slide::QA_STAGES
|
||||
* @param string $stage One of Slide::qaStages()
|
||||
* @return \App\Model\Entity\Slide
|
||||
*/
|
||||
public function setStage(Slide $slide, string $stage): Slide
|
||||
{
|
||||
if (!$slide->isQa() || !in_array($stage, Slide::QA_STAGES, true)) {
|
||||
if (!$slide->isQa() || !in_array($stage, $slide->qaStages(), true)) {
|
||||
throw new InvalidArgumentException('Unknown Q&A stage ' . $stage);
|
||||
}
|
||||
if ($slide->qaStage() === $stage && $slide->stage !== null) {
|
||||
@@ -95,18 +96,19 @@ class QaService
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves to the following stage (collect → vote → discuss).
|
||||
* Moves to the following stage (collect → vote → discuss, without upvotes collect → discuss).
|
||||
*
|
||||
* @param \App\Model\Entity\Slide $slide Q&A slide
|
||||
* @return bool False when already discussing
|
||||
*/
|
||||
public function advance(Slide $slide): bool
|
||||
{
|
||||
$index = (int)array_search($slide->qaStage(), Slide::QA_STAGES, true);
|
||||
if (!isset(Slide::QA_STAGES[$index + 1])) {
|
||||
$stages = $slide->qaStages();
|
||||
$index = (int)array_search($slide->qaStage(), $stages, true);
|
||||
if (!isset($stages[$index + 1])) {
|
||||
return false;
|
||||
}
|
||||
$this->setStage($slide, Slide::QA_STAGES[$index + 1]);
|
||||
$this->setStage($slide, $stages[$index + 1]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user