Merge branch 'dev' into 'staging'
use func See merge request frontend/squzanswerer!56
This commit is contained in:
commit
1d16b00fb8
@ -6,7 +6,7 @@ import { QuizIdContext } from "./contexts/QuizIdContext";
|
||||
import { RootContainerWidthContext } from "./contexts/RootContainerWidthContext";
|
||||
|
||||
// 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
|
||||
|
||||
export default function App() {
|
||||
|
@ -87,7 +87,7 @@ export function useQuestionFlowControl() {
|
||||
const findResultPointsLogic = () => {
|
||||
const results = questions
|
||||
.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)
|
||||
console.log(results)
|
||||
console.log(numbers)
|
||||
@ -95,7 +95,7 @@ export function useQuestionFlowControl() {
|
||||
return results[numbers.indexOf(indexOfNext)]
|
||||
}
|
||||
|
||||
const nextQuestion = () => {
|
||||
const getNextQuestion = () => {
|
||||
let next
|
||||
//Искать можно двумя логиками. Основной и балловой
|
||||
if (Boolean(settings.cfg.score)) {
|
||||
@ -129,7 +129,7 @@ export function useQuestionFlowControl() {
|
||||
console.log("next", next)
|
||||
return next
|
||||
}
|
||||
|
||||
const nextQuestion = getNextQuestion()
|
||||
const showResult = useCallback(() => {
|
||||
if (nextQuestion?.type !== "result") throw new Error("Current question is not result");
|
||||
if (isResultQuestionEmpty(nextQuestion)) {
|
||||
|
Loading…
Reference in New Issue
Block a user