Refine survey editor workflow and publication handling
This commit is contained in:
@@ -63,6 +63,28 @@ final class SurveyFlowService
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFirstQuestion(SurveyModel $survey): ?SurveyContentModel
|
||||
{
|
||||
$questions = $this->getOrderedQuestions($survey);
|
||||
|
||||
return $questions[0] ?? null;
|
||||
}
|
||||
|
||||
public function resolveQuestionById(SurveyModel $survey, int $questionId): ?SurveyContentModel
|
||||
{
|
||||
if ($questionId <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($this->getOrderedQuestions($survey) as $question) {
|
||||
if ((int) $question->id === $questionId) {
|
||||
return $question;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{current:int,total:int,percentage:int}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user