Тесты и опросы: критерии оценки, génération ИИ, улучшения конструктора и прохождения
- lib/quizzes.js: система criterial-оценки (quiz_grade_scales/quiz_grade_ranges), подсчёт баллов, попытки, anon-опросы, системные поля, доступ по коду - lib/quiz-grades.js: CRUD критериев оценки, диапазоны, картинки - lib/quiz-ai.js: генерация черновика теста через ИИ - server.js: роуты тестов, критериев, медиа-ассетов, попыток - db/init.sql + db/migration.sql: таблицы quizzes*, валидация и индексы - public/: конструктор, прохождение, публичная страница, список, критерии оценки - quiz.selftest.js, quiz-ai.selftest.js: юнит-проверки
This commit is contained in:
+5
-1
@@ -853,7 +853,7 @@ function normalizeRestoreData(data) {
|
||||
updated_at: optTs(x.updated_at),
|
||||
})).filter(x => x.source_id && x.photo_path);
|
||||
const quizKinds = ['test', 'survey'];
|
||||
const quizQuestionKinds = ['single', 'multiple', 'select', 'line', 'text', 'number', 'date'];
|
||||
const quizQuestionKinds = ['single', 'multiple', 'select', 'line', 'text', 'number', 'date', 'student', 'group', 'branch'];
|
||||
const quizWeight = v => Math.min(100, Math.max(0, Math.round((Number(v) || 0) * 100) / 100));
|
||||
const quizAssetKinds = ['image', 'audio', 'video', 'file'];
|
||||
const quizInt = (v, lo, hi, def = null) => {
|
||||
@@ -868,6 +868,7 @@ function normalizeRestoreData(data) {
|
||||
name: optText(x.name, 200) || '',
|
||||
description: optText(x.description, 2000) || null,
|
||||
sort_order: optInt(x.sort_order, -100000, 100000) ?? 0,
|
||||
is_shared: x.is_shared === true,
|
||||
created_by: x.created_by == null ? null : reqInt(x.created_by),
|
||||
created_at: optTs(x.created_at),
|
||||
updated_at: optTs(x.updated_at),
|
||||
@@ -896,9 +897,11 @@ function normalizeRestoreData(data) {
|
||||
grade_scale_id: x.grade_scale_id == null ? null : reqInt(x.grade_scale_id),
|
||||
max_attempts: quizInt(x.max_attempts, 1, 1000),
|
||||
time_limit_min: quizInt(x.time_limit_min, 0, 1440, 0),
|
||||
retry_cooldown_min: quizInt(x.retry_cooldown_min, 0, 10080, 0),
|
||||
pass_percent: quizInt(x.pass_percent, 0, 100, 60),
|
||||
cover_path: optUploadPath(x.cover_path, 300) || null,
|
||||
allow_anonymous: x.allow_anonymous === true,
|
||||
access_code: optText(x.access_code, 64) || null,
|
||||
author_id: x.author_id == null ? null : reqInt(x.author_id),
|
||||
created_at: optTs(x.created_at),
|
||||
updated_at: optTs(x.updated_at),
|
||||
@@ -984,6 +987,7 @@ function normalizeRestoreData(data) {
|
||||
option_ids: Array.isArray(x.option_ids) ? x.option_ids.map(Number).filter(n => Number.isInteger(n) && n > 0).slice(0, 25) : [],
|
||||
answer_snapshot: x.answer_snapshot && typeof x.answer_snapshot === 'object' && !Array.isArray(x.answer_snapshot) ? x.answer_snapshot : {},
|
||||
text_answer: optText(x.text_answer, 2000) || null,
|
||||
answer_id: x.answer_id == null ? null : quizInt(x.answer_id, 1, 1000000000),
|
||||
is_correct: x.is_correct == null ? null : x.is_correct === true,
|
||||
score: quizWeight(x.score),
|
||||
max_score: quizWeight(x.max_score),
|
||||
|
||||
Reference in New Issue
Block a user