Merge branch 'dev' into 'staging'

use func

See merge request frontend/squzanswerer!56
This commit is contained in:
Nastya 2024-02-11 19:19:09 +00:00
commit 1d16b00fb8
2 changed files with 4 additions and 4 deletions

@ -6,7 +6,7 @@ import { QuizIdContext } from "./contexts/QuizIdContext";
import { RootContainerWidthContext } from "./contexts/RootContainerWidthContext"; import { RootContainerWidthContext } from "./contexts/RootContainerWidthContext";
// const defaultQuizId = "45ef7f9c-784d-4e58-badb-f6b337f08ba0"; // branching // const defaultQuizId = "45ef7f9c-784d-4e58-badb-f6b337f08ba0"; // branching
const defaultQuizId = "48471ba0-a639-4be2-91e3-50149c4b73af"; //looooong header const defaultQuizId = "9ed8d0e9-d355-4fc1-8b89-4f962e3efc52"; //looooong header
// const defaultQuizId = "a9d31460-132a-4479-a3f0-90241498b6f9"; // linear // const defaultQuizId = "a9d31460-132a-4479-a3f0-90241498b6f9"; // linear
export default function App() { export default function App() {

@ -87,7 +87,7 @@ export function useQuestionFlowControl() {
const findResultPointsLogic = () => { const findResultPointsLogic = () => {
const results = questions const results = questions
.filter(e => e.type === "result" && e.content.rule.minScore !== undefined && e.content.rule.minScore <= pointsSum) .filter(e => e.type === "result" && e.content.rule.minScore !== undefined && e.content.rule.minScore <= pointsSum)
const numbers = results.map(e => e.content.rule.minScore) const numbers = results.map(e => e.type === "result" && e.content.rule.minScore !== undefined ? e.content.rule.minScore : 0)
const indexOfNext = Math.max(...numbers) const indexOfNext = Math.max(...numbers)
console.log(results) console.log(results)
console.log(numbers) console.log(numbers)
@ -95,7 +95,7 @@ export function useQuestionFlowControl() {
return results[numbers.indexOf(indexOfNext)] return results[numbers.indexOf(indexOfNext)]
} }
const nextQuestion = () => { const getNextQuestion = () => {
let next let next
//Искать можно двумя логиками. Основной и балловой //Искать можно двумя логиками. Основной и балловой
if (Boolean(settings.cfg.score)) { if (Boolean(settings.cfg.score)) {
@ -129,7 +129,7 @@ export function useQuestionFlowControl() {
console.log("next", next) console.log("next", next)
return next return next
} }
const nextQuestion = getNextQuestion()
const showResult = useCallback(() => { const showResult = useCallback(() => {
if (nextQuestion?.type !== "result") throw new Error("Current question is not result"); if (nextQuestion?.type !== "result") throw new Error("Current question is not result");
if (isResultQuestionEmpty(nextQuestion)) { if (isResultQuestionEmpty(nextQuestion)) {