ноды без имени говорят порядковый номер, квизы без имени говорят тип и колво вопросов внутри, тест
This commit is contained in:
parent
4953686ed6
commit
b9aacedd62
@ -55,6 +55,8 @@ export interface Quiz {
|
||||
average_time: number;
|
||||
/** set true if squiz realize group functionality */
|
||||
super: boolean;
|
||||
|
||||
questions_count: number;
|
||||
/** group of new quiz */
|
||||
group_id: number;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ function CsComponent({
|
||||
{
|
||||
data: {
|
||||
id: targetQuestion.content.id,
|
||||
label: targetQuestion.title === "" || targetQuestion.title === " " ? "noname" : targetQuestion.title,
|
||||
label: targetQuestion.title === "" || targetQuestion.title === " " ? "noname №" + targetQuestion.page : targetQuestion.title,
|
||||
parentType: parentNodeContentId
|
||||
}
|
||||
},
|
||||
|
||||
@ -21,7 +21,7 @@ export const storeToNodes = (questions: AnyTypedQuizQuestion[]) => {
|
||||
if (question.content.rule.parentId) {
|
||||
nodes.push({data: {
|
||||
id: question.content.id,
|
||||
label: question.title === "" || question.title === " " ? "noname" : question.title,
|
||||
label: question.title === "" || question.title === " " ? "noname №" + question.page : question.title,
|
||||
parentType: question.content.rule.parentId
|
||||
}})
|
||||
// nodes.push({
|
||||
|
||||
@ -157,7 +157,7 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
|
||||
if (!question.required) {//вопрос не обязателен и не нашли совпадений между ответами и условиями ветвления
|
||||
console.log("вопрос не обязателен ищем дальше")
|
||||
const defaultQ = question.content.rule.default
|
||||
if (defaultQ) return defaultQ
|
||||
if (defaultQ.length > 1 && defaultQ !== " ") return defaultQ
|
||||
//Вопросы типа страница, ползунок, своё поле для ввода и дата не могут иметь больше 1 ребёнка. Пользователь не может настроить там дефолт
|
||||
//Кинуть на ребёнка надо даже если там нет дефолта
|
||||
if (
|
||||
|
||||
@ -27,6 +27,8 @@ export default function QuizCard({ quiz, openCount = 0, applicationCount = 0, co
|
||||
navigate("/edit");
|
||||
}
|
||||
|
||||
const questionCount = useRef(quiz.questions_count.toString() || "")
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@ -50,7 +52,15 @@ export default function QuizCard({ quiz, openCount = 0, applicationCount = 0, co
|
||||
sx={{ textOverflow: "ellipsis", overflow: "hidden", whiteSpace: "nowrap", widows: "100%" }}
|
||||
variant="h5"
|
||||
>
|
||||
{quiz.name}
|
||||
{
|
||||
quiz.name.length === 0 || quiz.name === " " ?
|
||||
quiz.config.type === "form" ?
|
||||
"Анкета " + questionCount.current
|
||||
:
|
||||
"Квиз " + questionCount.current
|
||||
:
|
||||
quiz.name
|
||||
}
|
||||
</Typography>
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
@ -77,6 +77,7 @@ export default function EditPage() {
|
||||
const quiz = useCurrentQuiz();
|
||||
const { editQuizId } = useQuizStore();
|
||||
const { questions } = useQuestionsStore();
|
||||
console.log(questions)
|
||||
|
||||
useEffect(() => {
|
||||
const getData = async () => {
|
||||
|
||||
@ -53,9 +53,11 @@ export const checkQuestionHint = (questions: AnyTypedQuizQuestion, quiz:Quiz): R
|
||||
question.content.rule.main.forEach((condition: QuestionBranchingRuleMain) => {
|
||||
buffer.forEach((oldCondition: QuestionBranchingRuleMain) => {
|
||||
if (areRulesEqual(condition.rules, oldCondition.rules)) {
|
||||
const q = getQuestionByContentId(condition.next)
|
||||
const oldq = getQuestionByContentId(oldCondition.next)
|
||||
pushProblem(
|
||||
question.content.id,
|
||||
`У вопроса "${getQuestionByContentId(condition.next)?.title || "noname"}" и "${getQuestionByContentId(oldCondition.next)?.title || "noname"}" одинаковые условия ветвления`,
|
||||
`У вопроса "${q?.title || "noname №" + q?.page}" и "${oldq?.title || "noname №" + oldq?.page}" одинаковые условия ветвления`,
|
||||
question.title
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user