Merge branch 'dev' into 'staging'

10 баллов не ломают балловый опросник

See merge request frontend/squzanswerer!58
This commit is contained in:
Nastya 2024-02-12 00:54:39 +00:00
commit 27e930731a
2 changed files with 45 additions and 32 deletions

@ -160,7 +160,11 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
p: "20px", p: settings.cfg.resultInfo.showResultForm === "before" ||
(
settings.cfg.resultInfo.showResultForm === "after" &&
resultQuestion.content.redirect
) ? "20px" : "0",
}} }}
> >
{settings.cfg.resultInfo.showResultForm === "before" && ( {settings.cfg.resultInfo.showResultForm === "before" && (

@ -97,36 +97,45 @@ export function useQuestionFlowControl() {
const getNextQuestion = () => { const getNextQuestion = () => {
let next let next
console.log(11111111111)
//Искать можно двумя логиками. Основной и балловой //Искать можно двумя логиками. Основной и балловой
if (Boolean(settings.cfg.score)) { if (Boolean(settings.cfg.score)) {
//Балловая //Балловая
console.log(222222222)
//Ищем линейно //Ищем линейно
if (linearQuestionIndex !== null) { if (linearQuestionIndex !== null) {
console.log(33333333333)
next = questions[linearQuestionIndex + 1] next = questions[linearQuestionIndex + 1]
if (next.type === "result") next = findResultPointsLogic() console.log(4444444)
console.log("перед ифом", next)
if (next?.type === "result" || next == undefined) next = findResultPointsLogic()
console.log(5555555555)
} }
} else { } else {
console.log(6666666)
//Основная //Основная
if (linearQuestionIndex !== null) { if (linearQuestionIndex !== null) {
console.log(777777777)
//Ищем линейно //Ищем линейно
next = questions[linearQuestionIndex + 1] ?? questions.find(question => next = questions[linearQuestionIndex + 1] ?? questions.find(question =>
question.type === "result" && question.content.rule.parentId === "line" question.type === "result" && question.content.rule.parentId === "line"
) )
} else { } else {
console.log(88888888888888)
//Ищем ветвлением //Ищем ветвлением
next = questions.find(q => q.id === calculateNextQuestionId || q.content.id === calculateNextQuestionId); next = questions.find(q => q.id === calculateNextQuestionId || q.content.id === calculateNextQuestionId);
} }
} }
if (!next) throw new Error("Не найден следующий вопрос")
console.log("next", next) console.log("next", next)
if (!next) throw new Error("Не найден следующий вопрос")
return next return next
} }
const nextQuestion = getNextQuestion() const nextQuestion = getNextQuestion()