fix test editor UI and test completition UI
This commit is contained in:
@@ -46,7 +46,13 @@ def _to_uuid(val) -> _uuid.UUID | None:
|
||||
|
||||
# ─── load questions (shared) ─────────────────────────────────────────────────
|
||||
|
||||
def load_questions_for_version(session: Session, test_version_id, *, include_correct: bool) -> list[dict]:
|
||||
def load_questions_for_version(
|
||||
session: Session,
|
||||
test_version_id,
|
||||
*,
|
||||
include_correct: bool,
|
||||
include_hints: bool = False,
|
||||
) -> list[dict]:
|
||||
vid = _to_uuid(test_version_id)
|
||||
if vid is None:
|
||||
return []
|
||||
@@ -65,13 +71,17 @@ def load_questions_for_version(session: Session, test_version_id, *, include_cor
|
||||
if include_correct:
|
||||
base['isCorrect'] = bool(o.is_correct)
|
||||
options.append(base)
|
||||
out.append({
|
||||
item = {
|
||||
'id': str(q.id),
|
||||
'text': q.text,
|
||||
'questionOrder': q.question_order,
|
||||
'hasMultipleAnswers': bool(q.has_multiple_answers),
|
||||
'options': options,
|
||||
})
|
||||
}
|
||||
if include_hints:
|
||||
hint = (q.ai_hint or '').strip()
|
||||
item['aiHint'] = hint or None
|
||||
out.append(item)
|
||||
return out
|
||||
|
||||
|
||||
@@ -275,7 +285,9 @@ def build_review_from_db(session: Session, attempt_id: str) -> dict:
|
||||
raise HttpError(400, 'Попытка не завершена.')
|
||||
|
||||
test = attempt.test_version.test
|
||||
questions = load_questions_for_version(session, attempt.test_version_id, include_correct=True)
|
||||
questions = load_questions_for_version(
|
||||
session, attempt.test_version_id, include_correct=True, include_hints=True
|
||||
)
|
||||
|
||||
sel_by_q: dict[str, list[str]] = {
|
||||
str(ua.question_id): [str(x) for x in (ua.selected_options or [])]
|
||||
@@ -294,6 +306,7 @@ def build_review_from_db(session: Session, attempt_id: str) -> dict:
|
||||
'id': q['id'],
|
||||
'text': q['text'],
|
||||
'hasMultipleAnswers': q['hasMultipleAnswers'],
|
||||
'aiHint': q.get('aiHint'),
|
||||
'isUserCorrect': _same_selection(selected, correct),
|
||||
'options': [
|
||||
{
|
||||
|
||||
@@ -736,9 +736,19 @@ body.ui-legacy .test-detail-subsection__title {
|
||||
margin-bottom: 0.6rem;
|
||||
color: var(--ink-900, #111827);
|
||||
}
|
||||
body.ui-legacy .test-detail-ai-panel {
|
||||
padding: 1rem 1.1rem 1.1rem;
|
||||
margin-bottom: 1.25rem;
|
||||
|
||||
/* Панель «Инструменты генерации»: одинаковые отступы по краям и снизу */
|
||||
.editor-generation-panel {
|
||||
box-sizing: border-box;
|
||||
padding: 1rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.editor-generation-panel__status {
|
||||
margin-top: 0.75rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.editor-generation-panel__status:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ─── Option row alignment ───────────────────────────────────────── */
|
||||
@@ -895,6 +905,10 @@ body.ui-legacy .test-detail-ai-panel {
|
||||
border-radius: 0.85rem;
|
||||
box-shadow: none;
|
||||
}
|
||||
body.ui-legacy .test-detail-ai-panel.editor-generation-panel {
|
||||
padding: 1rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
body.ui-legacy .assign-toolbar {
|
||||
display: flex;
|
||||
@@ -948,7 +962,6 @@ body.ui-legacy .assign-row__fio { font-weight: 600; font-size: 0.95rem; }
|
||||
body.ui-legacy .assign-row__login { font-size: 0.8rem; color: #506965; font-family: ui-monospace, Menlo, monospace; }
|
||||
body.ui-legacy .assign-row__meta { font-size: 0.8rem; color: #506965; line-height: 1.35; }
|
||||
|
||||
body.ui-legacy .version-card-list,
|
||||
body.ui-legacy .attempts-card-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
@@ -958,43 +971,85 @@ body.ui-legacy .attempts-card-list {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
/* ─── Version items (compact row in top section) ─────────────────── */
|
||||
body.ui-legacy .version-item {
|
||||
/* ─── Версии теста (редактор): одна высота строки, «активная» справа ─ */
|
||||
.version-card-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.version-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
min-height: 3.35rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
box-sizing: border-box;
|
||||
border-radius: 0.6rem;
|
||||
background: var(--surface-container-low, #f5f5f5);
|
||||
border: 1px solid var(--outline-variant, #e0e0e0);
|
||||
}
|
||||
body.ui-legacy .version-item[data-active="1"] {
|
||||
background: color-mix(in srgb, var(--primary, #007168) 8%, white);
|
||||
border-color: color-mix(in srgb, var(--primary, #007168) 25%, transparent);
|
||||
|
||||
.version-item__main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 0.12rem;
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
body.ui-legacy .version-item__label {
|
||||
|
||||
.version-item__label {
|
||||
font-weight: 600;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.version-item__date {
|
||||
font-size: 0.78rem;
|
||||
line-height: 1.25;
|
||||
color: var(--ink-500, #6b7280);
|
||||
}
|
||||
|
||||
.version-item__actions {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
justify-content: flex-end;
|
||||
min-width: 8.5rem;
|
||||
}
|
||||
body.ui-legacy .version-item__badge {
|
||||
|
||||
.version-item__badge {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 500;
|
||||
padding: 0.1rem 0.4rem;
|
||||
font-weight: 600;
|
||||
padding: 0.22rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
background: var(--primary, #007168);
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
body.ui-legacy .version-item__date {
|
||||
font-size: 0.78rem;
|
||||
flex: 1;
|
||||
|
||||
.version-item[data-active="1"] {
|
||||
background: color-mix(in srgb, var(--primary, #007168) 8%, white);
|
||||
border-color: color-mix(in srgb, var(--primary, #007168) 25%, transparent);
|
||||
}
|
||||
body.ui-legacy .version-item__spacer {
|
||||
width: 1px;
|
||||
|
||||
body.ui-modern .version-item {
|
||||
background: #fff;
|
||||
border-color: rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
body.ui-modern .version-item[data-active="1"] {
|
||||
background: color-mix(in srgb, var(--brand-600, #6366f1) 6%, #fff);
|
||||
border-color: color-mix(in srgb, var(--brand-600, #6366f1) 28%, transparent);
|
||||
}
|
||||
body.ui-modern .version-item__badge {
|
||||
background: var(--brand-600, #6366f1);
|
||||
}
|
||||
body.ui-legacy #versions-section {
|
||||
padding: 0.75rem 1rem;
|
||||
@@ -1024,28 +1079,280 @@ body.ui-legacy .attempts-card-list__action {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.attempt-review-options {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
/* ─── Разбор попытки (attempt_review.html) ───────────────────────── */
|
||||
.attempt-review-page {
|
||||
max-width: 42rem;
|
||||
margin: 0 auto;
|
||||
padding: 0 0.25rem 2rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.attempt-review-page__header {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.attempt-review-page__back {
|
||||
margin: 0 0 0.75rem;
|
||||
}
|
||||
|
||||
.attempt-review-page__title {
|
||||
font-size: clamp(1.15rem, 2.5vw, 1.45rem);
|
||||
line-height: 1.25;
|
||||
margin: 0 0 0.5rem;
|
||||
color: var(--ink-900, #111827);
|
||||
}
|
||||
|
||||
.attempt-review-page__params {
|
||||
margin: 0 0 1rem;
|
||||
line-height: 1.5;
|
||||
color: var(--ink-500, #6b7280);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.attempt-review-score {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem 1rem;
|
||||
padding: 1rem 1.1rem;
|
||||
border-radius: 0.85rem;
|
||||
border: 1px solid color-mix(in srgb, var(--outline-variant) 45%, transparent);
|
||||
background: var(--surface, #fff);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.attempt-review-score--pass {
|
||||
border-color: color-mix(in srgb, var(--primary, #007168) 35%, transparent);
|
||||
background: color-mix(in srgb, var(--primary, #007168) 6%, var(--surface));
|
||||
}
|
||||
|
||||
.attempt-review-score--fail {
|
||||
border-color: color-mix(in srgb, #b42318 22%, transparent);
|
||||
background: color-mix(in srgb, #fef2f2 85%, var(--surface));
|
||||
}
|
||||
|
||||
.attempt-review-score__label {
|
||||
display: block;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--on-surface-variant);
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.attempt-review-score__value {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
line-height: 1.4;
|
||||
color: var(--ink-900, #111827);
|
||||
}
|
||||
|
||||
.attempt-review-option {
|
||||
margin: 0.25rem 0;
|
||||
padding: 0.3rem 0.5rem;
|
||||
border-radius: 0.55rem;
|
||||
.attempt-review-score__percent {
|
||||
font-weight: 500;
|
||||
color: var(--ink-600, #4b5563);
|
||||
}
|
||||
|
||||
.attempt-review-option--wrong {
|
||||
background: #fef2f2;
|
||||
.attempt-review-score__threshold {
|
||||
margin: 0.35rem 0 0;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--ink-500, #6b7280);
|
||||
}
|
||||
|
||||
.attempt-review-score__verdict {
|
||||
align-self: center;
|
||||
flex-shrink: 0;
|
||||
padding: 0.45rem 0.85rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.attempt-review-score--pass .attempt-review-score__verdict {
|
||||
background: color-mix(in srgb, var(--primary, #007168) 18%, transparent);
|
||||
color: var(--primary, #007168);
|
||||
}
|
||||
|
||||
.attempt-review-score--fail .attempt-review-score__verdict {
|
||||
background: #fee2e2;
|
||||
color: #b42318;
|
||||
}
|
||||
|
||||
.attempt-review-option--correct {
|
||||
.attempt-review-page__list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.attempt-review-card {
|
||||
margin: 0;
|
||||
padding: 1rem 1.1rem 1.15rem;
|
||||
border-radius: 0.85rem;
|
||||
border: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
|
||||
background: var(--surface, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.attempt-review-card__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.65rem;
|
||||
}
|
||||
|
||||
.attempt-review-card__num {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
padding: 0 0.4rem;
|
||||
border-radius: 0.45rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
background: color-mix(in srgb, var(--outline-variant) 35%, transparent);
|
||||
color: var(--ink-700, #374151);
|
||||
}
|
||||
|
||||
.attempt-review-card__badge {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
padding: 0.25rem 0.55rem;
|
||||
border-radius: 999px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.attempt-review-card__badge--ok {
|
||||
background: color-mix(in srgb, var(--primary, #007168) 14%, transparent);
|
||||
color: var(--primary, #0a6b5c);
|
||||
}
|
||||
|
||||
.attempt-review-card__badge--bad {
|
||||
background: #fee2e2;
|
||||
color: #b42318;
|
||||
}
|
||||
|
||||
.attempt-review-card__question {
|
||||
margin: 0 0 0.75rem;
|
||||
font-size: 1.02rem;
|
||||
line-height: 1.45;
|
||||
color: var(--ink-900, #111827);
|
||||
}
|
||||
|
||||
.attempt-review-hint {
|
||||
margin: 0 0 1rem;
|
||||
padding: 0.75rem 0.95rem;
|
||||
border-radius: 0.65rem;
|
||||
border: 1px solid color-mix(in srgb, var(--brand-500, #6366f1) 22%, transparent);
|
||||
background: color-mix(in srgb, var(--brand-50, #eef2ff) 88%, var(--surface));
|
||||
}
|
||||
|
||||
.attempt-review-hint__label {
|
||||
display: block;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--on-surface-variant);
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.attempt-review-hint__text {
|
||||
margin: 0;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.5;
|
||||
color: var(--on-surface);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.attempt-review-options {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
.attempt-review-option {
|
||||
margin: 0;
|
||||
padding: 0.65rem 0.85rem;
|
||||
border-radius: 0.65rem;
|
||||
border: 1px solid color-mix(in srgb, var(--outline-variant) 55%, transparent);
|
||||
background: color-mix(in srgb, var(--surface-container-low) 55%, var(--surface));
|
||||
transition: border-color 0.12s ease;
|
||||
}
|
||||
|
||||
.attempt-review-option__text {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.55rem;
|
||||
font-size: 0.94rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.attempt-review-option__mark {
|
||||
flex-shrink: 0;
|
||||
font-size: 1rem;
|
||||
line-height: 1.35;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.attempt-review-option__body {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.attempt-review-option__tag {
|
||||
display: inline-block;
|
||||
margin-left: 0.35rem;
|
||||
padding: 0.1rem 0.4rem;
|
||||
border-radius: 0.35rem;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
vertical-align: middle;
|
||||
background: #ecfdf3;
|
||||
color: #067647;
|
||||
}
|
||||
|
||||
.attempt-review-option--wrong {
|
||||
border-color: color-mix(in srgb, #b42318 28%, transparent);
|
||||
background: #fef2f2;
|
||||
color: #7f1d1d;
|
||||
}
|
||||
|
||||
.attempt-review-option--wrong .attempt-review-option__tag {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.attempt-review-option--correct {
|
||||
border-color: color-mix(in srgb, #067647 35%, transparent);
|
||||
background: #ecfdf3;
|
||||
color: #14532d;
|
||||
}
|
||||
|
||||
body.ui-modern .attempt-review-page {
|
||||
padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
body.ui-modern .attempt-review-card {
|
||||
border-color: rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
|
||||
body.ui-legacy .attempt-review-page {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
/* ─── Прохождение теста: один вопрос, прогресс сверху, удобно с телефона ─── */
|
||||
.attempt-root {
|
||||
max-width: var(--max-content);
|
||||
@@ -1327,11 +1634,192 @@ body.ui-legacy .attempts-card-list__action {
|
||||
}
|
||||
|
||||
.attempt-result-card {
|
||||
padding: 1.25rem 1.35rem;
|
||||
padding: 1.35rem 1.35rem 1.5rem;
|
||||
max-width: 22rem;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: center;
|
||||
/* Трек и центр — белые; цвет только на дугах результата / порога */
|
||||
--attempt-result-track: #fff;
|
||||
--attempt-result-disk: #fff;
|
||||
--attempt-result-fail-score: var(--primary, #007168);
|
||||
--attempt-result-gap: color-mix(in srgb, #f87171 22%, #fecaca 78%);
|
||||
--attempt-result-pass: color-mix(in srgb, #22c55e 92%, #15803d 8%);
|
||||
--attempt-result-ring-width: 9px;
|
||||
}
|
||||
|
||||
.attempt-result-card__inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.attempt-result-title {
|
||||
margin: 0 0 0.75rem;
|
||||
margin: 0 0 1rem;
|
||||
font-size: 1.125rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.attempt-result-visual {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
margin-bottom: 1.1rem;
|
||||
animation: attempt-result-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||
}
|
||||
|
||||
@keyframes attempt-result-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(0.35rem) scale(0.96);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.attempt-result-donut {
|
||||
position: relative;
|
||||
width: 10.75rem;
|
||||
height: 10.75rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.attempt-result-donut__svg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
overflow: visible;
|
||||
filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.08)) drop-shadow(0 2px 6px rgba(15, 23, 42, 0.06));
|
||||
}
|
||||
|
||||
.attempt-result-svg__track {
|
||||
stroke: var(--attempt-result-track);
|
||||
stroke-width: var(--attempt-result-ring-width);
|
||||
stroke-linecap: round;
|
||||
}
|
||||
|
||||
.attempt-result-svg__pass,
|
||||
.attempt-result-svg__fail-score,
|
||||
.attempt-result-svg__fail-gap {
|
||||
fill: none;
|
||||
stroke-width: var(--attempt-result-ring-width);
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.attempt-result-svg__pass {
|
||||
stroke: var(--attempt-result-pass);
|
||||
}
|
||||
|
||||
.attempt-result-svg__fail-score {
|
||||
stroke: var(--attempt-result-fail-score);
|
||||
}
|
||||
|
||||
.attempt-result-svg__fail-gap {
|
||||
stroke: var(--attempt-result-gap);
|
||||
}
|
||||
|
||||
.attempt-result-donut__disk {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
z-index: 1;
|
||||
width: 71%;
|
||||
height: 71%;
|
||||
transform: translate(-50%, -50%);
|
||||
border-radius: 50%;
|
||||
background: var(--attempt-result-disk);
|
||||
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.05);
|
||||
}
|
||||
|
||||
.attempt-result-donut__center {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.attempt-result-donut__icon {
|
||||
font-size: 2.75rem !important;
|
||||
font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.attempt-result-donut__center[data-passed="1"] .attempt-result-donut__icon {
|
||||
color: var(--attempt-result-pass);
|
||||
}
|
||||
|
||||
.attempt-result-donut__center[data-passed="0"] .attempt-result-donut__icon {
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.attempt-result-verdict {
|
||||
margin: 0.5rem 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.attempt-result-verdict__label {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.attempt-result-verdict[data-passed="1"] .attempt-result-verdict__label {
|
||||
color: var(--attempt-result-pass);
|
||||
}
|
||||
|
||||
.attempt-result-verdict[data-passed="0"] .attempt-result-verdict__label {
|
||||
color: #b42318;
|
||||
}
|
||||
|
||||
.attempt-result-stats {
|
||||
list-style: none;
|
||||
margin: 0 0 1.1rem;
|
||||
padding: 0.65rem 0.85rem;
|
||||
width: 100%;
|
||||
max-width: 18rem;
|
||||
text-align: left;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.45;
|
||||
color: var(--ink-700, #3d5357);
|
||||
background: color-mix(in srgb, var(--surface-container-low, #f5f5f5) 88%, transparent);
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid color-mix(in srgb, var(--outline-variant, #e0e0e0) 45%, transparent);
|
||||
}
|
||||
|
||||
.attempt-result-stats li + li {
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
|
||||
.attempt-result-stats__k {
|
||||
color: var(--on-surface-variant, #506965);
|
||||
font-weight: 500;
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.attempt-result-actions {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.attempt-result-review-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
min-height: 2.75rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.attempt-passed {
|
||||
@@ -1344,6 +1832,13 @@ body.ui-legacy .attempts-card-list__action {
|
||||
color: #b42318;
|
||||
}
|
||||
|
||||
body.ui-modern .attempt-result-card {
|
||||
--attempt-result-fail-score: var(--brand-600, #6366f1);
|
||||
}
|
||||
body.ui-modern .attempt-result-verdict[data-passed="1"] .attempt-result-verdict__label {
|
||||
color: var(--attempt-result-pass);
|
||||
}
|
||||
|
||||
body.ui-modern .attempt-flow {
|
||||
min-height: min(75dvh, 880px);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,24 @@
|
||||
}[m]));
|
||||
}
|
||||
|
||||
/** Доля круга 0..1 от верха по часовой; путь для stroke с round caps (viewBox 120). */
|
||||
function attemptResultArcD(cx, cy, r, t0, t1) {
|
||||
if (t1 <= t0 + 1e-9) return '';
|
||||
if (t1 - t0 > 0.5 + 1e-6) {
|
||||
const a = attemptResultArcD(cx, cy, r, t0, t0 + 0.5);
|
||||
const b = attemptResultArcD(cx, cy, r, t0 + 0.5, t1);
|
||||
return `${a} ${b.replace(/^M [\d.]+\s+[\d.]+\s+/, '')}`;
|
||||
}
|
||||
const angle = (t) => (-Math.PI / 2) + 2 * Math.PI * t;
|
||||
const x0 = cx + r * Math.cos(angle(t0));
|
||||
const y0 = cy + r * Math.sin(angle(t0));
|
||||
const x1 = cx + r * Math.cos(angle(t1));
|
||||
const y1 = cy + r * Math.sin(angle(t1));
|
||||
const spanDeg = (t1 - t0) * 360;
|
||||
const largeArc = spanDeg > 180 ? 1 : 0;
|
||||
return `M ${x0.toFixed(2)} ${y0.toFixed(2)} A ${r} ${r} 0 ${largeArc} 1 ${x1.toFixed(2)} ${y1.toFixed(2)}`;
|
||||
}
|
||||
|
||||
function setErr(msg) {
|
||||
errEl.textContent = msg || 'Ошибка.';
|
||||
errEl.style.display = msg ? 'block' : 'none';
|
||||
@@ -321,12 +339,58 @@
|
||||
timerEl.style.display = 'none';
|
||||
if (flowEl) flowEl.style.display = 'none';
|
||||
resultEl.style.display = '';
|
||||
resultEl.innerHTML =
|
||||
`<h3 class="attempt-result-title font-headline">Результат</h3>`
|
||||
+ `<p>Правильно: <strong>${data.correctCount}</strong> из ${data.totalQuestions}`
|
||||
+ ` (${data.percent}%). Порог: ${data.passingThreshold}%.</p>`
|
||||
+ `<p class="${data.passed ? 'attempt-passed' : 'attempt-failed'}">${data.passed ? 'Зачёт' : 'Незачёт'}</p>`
|
||||
+ `<p><a class="link-back" href="/tests/${testId}/attempts/${data.attemptId}/review">Разбор попытки</a></p>`;
|
||||
const pct = Math.min(100, Math.max(0, Number(data.percent) || 0));
|
||||
const thr = Math.min(100, Math.max(0, Number(data.passingThreshold) || 0));
|
||||
const passed = !!data.passed;
|
||||
const thrArc = passed ? pct : Math.min(100, Math.max(pct, thr));
|
||||
const centerIcon = passed ? 'check' : 'close';
|
||||
const verdictLabel = passed ? 'Зачёт' : 'Незачёт';
|
||||
const ariaRing = passed
|
||||
? `Зачёт: ${pct} процентов верных ответов`
|
||||
: `Незачёт: ${pct} процентов, порог ${thr} процентов`;
|
||||
const CX = 60;
|
||||
const CY = 60;
|
||||
const RAD = 48;
|
||||
const tScore = pct / 100;
|
||||
const tThr = thrArc / 100;
|
||||
const trackCircle = `<circle class="attempt-result-svg__track" cx="${CX}" cy="${CY}" r="${RAD}" fill="none" />`;
|
||||
let arcPaths = '';
|
||||
if (passed) {
|
||||
const dPass = attemptResultArcD(CX, CY, RAD, 0, tScore);
|
||||
if (dPass) {
|
||||
arcPaths += `<path class="attempt-result-svg__pass" d="${esc(dPass)}" fill="none" />`;
|
||||
}
|
||||
} else {
|
||||
const dGap = tThr > tScore + 1e-9 ? attemptResultArcD(CX, CY, RAD, tScore, tThr) : '';
|
||||
const dScore = tScore > 1e-9 ? attemptResultArcD(CX, CY, RAD, 0, tScore) : '';
|
||||
if (dGap) arcPaths += `<path class="attempt-result-svg__fail-gap" d="${esc(dGap)}" fill="none" />`;
|
||||
if (dScore) arcPaths += `<path class="attempt-result-svg__fail-score" d="${esc(dScore)}" fill="none" />`;
|
||||
}
|
||||
const donutSvg = `<svg class="attempt-result-donut__svg" viewBox="0 0 120 120" aria-hidden="true">${trackCircle}${arcPaths}</svg>`;
|
||||
resultEl.innerHTML = `
|
||||
<div class="attempt-result-card__inner">
|
||||
<h3 class="attempt-result-title font-headline">Результат</h3>
|
||||
<div class="attempt-result-visual" aria-label="${ariaRing.replace(/"/g, '"')}">
|
||||
<div class="attempt-result-donut">
|
||||
${donutSvg}
|
||||
<div class="attempt-result-donut__disk" aria-hidden="true"></div>
|
||||
<div class="attempt-result-donut__center" data-passed="${passed ? '1' : '0'}">
|
||||
<span class="material-symbols-outlined attempt-result-donut__icon" aria-hidden="true">${centerIcon}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="attempt-result-verdict" data-passed="${passed ? '1' : '0'}">
|
||||
<span class="attempt-result-verdict__label">${verdictLabel}</span>
|
||||
</p>
|
||||
</div>
|
||||
<ul class="attempt-result-stats">
|
||||
<li><span class="attempt-result-stats__k">Верно</span> <strong>${data.correctCount}</strong> из ${data.totalQuestions} (${pct}%)</li>
|
||||
<li><span class="attempt-result-stats__k">Порог зачёта</span> <strong>${thr}%</strong></li>
|
||||
</ul>
|
||||
<p class="attempt-result-actions">
|
||||
<a class="btn btn-primary attempt-result-review-link"
|
||||
href="/tests/${testId}/attempts/${data.attemptId}/review">Разбор попытки</a>
|
||||
</p>
|
||||
</div>`;
|
||||
} catch (e) {
|
||||
setErr(e.message);
|
||||
btnFinish.disabled = false;
|
||||
|
||||
@@ -1419,15 +1419,16 @@
|
||||
li.dataset.versionId = r.id;
|
||||
li.dataset.active = r.is_active ? '1' : '0';
|
||||
li.innerHTML = `
|
||||
<span class="version-item__label">
|
||||
Версия ${r.version}
|
||||
${r.is_active ? '<span class="version-item__badge">активная</span>' : ''}
|
||||
</span>
|
||||
<span class="version-item__date muted">${fmtDt(r.created_at)}</span>
|
||||
${!r.is_active
|
||||
? `<button class="btn btn-ghost btn--sm version-item__activate" type="button"
|
||||
data-version-id="${escHtml(r.id)}">Сделать активной</button>`
|
||||
: '<span class="version-item__spacer"></span>'}`;
|
||||
<div class="version-item__main">
|
||||
<span class="version-item__label">Версия ${r.version}</span>
|
||||
<span class="version-item__date">${fmtDt(r.created_at)}</span>
|
||||
</div>
|
||||
<div class="version-item__actions">
|
||||
${r.is_active
|
||||
? '<span class="version-item__badge">активная</span>'
|
||||
: `<button class="btn btn-ghost btn--sm version-item__activate" type="button"
|
||||
data-version-id="${escHtml(r.id)}">Сделать активной</button>`}
|
||||
</div>`;
|
||||
versionsListEl.appendChild(li);
|
||||
});
|
||||
versionsListEl.querySelectorAll('.version-item__activate').forEach((btn) => {
|
||||
|
||||
@@ -3,42 +3,54 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="test-detail-page attempt-review-page">
|
||||
<p class="link-back"><a href="/tests">← к списку тестов</a></p>
|
||||
<h1 class="font-headline" style="font-size:1.35rem;margin-top:0;">Разбор: {{ review.testTitle }}</h1>
|
||||
{% set tl = review.timeLimit %}
|
||||
{% set timestr = 'без ограничения' if tl is none or tl == 0 else (tl|string ~ ' мин') %}
|
||||
{% set rm = review.resultMode or 'end' %}
|
||||
{% set res = 'сразу' if rm == 'immediate' else 'в конце' %}
|
||||
{% set hint = 'недоступны' if rm != 'immediate' else ('вкл' if review.hintsEnabled else 'выкл') %}
|
||||
<p class="text-sm text-muted" style="margin:0.35rem 0 0.75rem;line-height:1.45;">
|
||||
Порог: {{ review.passingThreshold }}% · Вопросов: {{ review.totalQuestions }} · Время: {{ timestr }} · Результат: {{ res }} · Подсказки: {{ hint }}
|
||||
</p>
|
||||
<p>
|
||||
Правильно: <strong>{{ review.correctCount }}</strong> из {{ review.totalQuestions }}
|
||||
({{ review.percent }}%). Порог: {{ review.passingThreshold }}%.
|
||||
{% if review.passed %}
|
||||
<span class="text-muted">Зачёт.</span>
|
||||
{% else %}
|
||||
<span class="error-text">Незачёт.</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
<header class="attempt-review-page__header">
|
||||
<p class="link-back attempt-review-page__back"><a href="/tests">← к списку тестов</a></p>
|
||||
<h1 class="attempt-review-page__title font-headline">Разбор: {{ review.testTitle }}</h1>
|
||||
{% set tl = review.timeLimit %}
|
||||
{% set timestr = 'без ограничения' if tl is none or tl == 0 else (tl|string ~ ' мин') %}
|
||||
{% set rm = review.resultMode or 'end' %}
|
||||
{% set res = 'сразу' if rm == 'immediate' else 'в конце' %}
|
||||
{% set hint = 'недоступны' if rm != 'immediate' else ('вкл' if review.hintsEnabled else 'выкл') %}
|
||||
<p class="attempt-review-page__params text-muted text-sm">
|
||||
Порог: {{ review.passingThreshold }}% · Вопросов: {{ review.totalQuestions }} · Время: {{ timestr }} · Результат: {{ res }} · Подсказки: {{ hint }}
|
||||
</p>
|
||||
<div class="attempt-review-score {% if review.passed %}attempt-review-score--pass{% else %}attempt-review-score--fail{% endif %}">
|
||||
<div class="attempt-review-score__main">
|
||||
<span class="attempt-review-score__label">Итог</span>
|
||||
<p class="attempt-review-score__value">
|
||||
Правильно <strong>{{ review.correctCount }}</strong> из {{ review.totalQuestions }}
|
||||
<span class="attempt-review-score__percent">({{ review.percent }}%)</span>
|
||||
</p>
|
||||
<p class="attempt-review-score__threshold">Порог зачёта: {{ review.passingThreshold }}%</p>
|
||||
</div>
|
||||
<span class="attempt-review-score__verdict">{% if review.passed %}Зачёт{% else %}Незачёт{% endif %}</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="attempts-card-list">
|
||||
<div class="attempt-review-page__list">
|
||||
{% for q in review.questions %}
|
||||
<article class="attempt-card">
|
||||
<div class="attempt-card__meta">
|
||||
<span>{{ 'Верно' if q.isUserCorrect else 'Ошибка' }}</span>
|
||||
<article class="attempt-card attempt-review-card">
|
||||
<div class="attempt-review-card__head">
|
||||
<span class="attempt-review-card__num">{{ loop.index }}</span>
|
||||
<span class="attempt-review-card__badge {% if q.isUserCorrect %}attempt-review-card__badge--ok{% else %}attempt-review-card__badge--bad{% endif %}">
|
||||
{{ 'Верно' if q.isUserCorrect else 'Ошибка' }}
|
||||
</span>
|
||||
</div>
|
||||
<p style="margin-top:.25rem;"><strong>{{ loop.index }}.</strong> {{ q.text }}</p>
|
||||
<ul class="attempt-review-options">
|
||||
<p class="attempt-review-card__question">{{ q.text }}</p>
|
||||
{% if q.aiHint %}
|
||||
<div class="attempt-review-hint">
|
||||
<span class="attempt-review-hint__label">Подсказка</span>
|
||||
<p class="attempt-review-hint__text">{{ q.aiHint }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<ul class="attempt-review-options" role="list">
|
||||
{% for o in q.options %}
|
||||
<li class="attempt-review-option
|
||||
{% if o.isCorrect %}attempt-review-option--correct{% endif %}
|
||||
{% if o.selected and not o.isCorrect %}attempt-review-option--wrong{% endif %}">
|
||||
<span class="attempt-review-option__text">
|
||||
{% if o.selected %}☑{% else %}☐{% endif %}
|
||||
{{ o.text }}
|
||||
{% if o.isCorrect %}<strong> (правильный)</strong>{% endif %}
|
||||
<span class="attempt-review-option__mark" aria-hidden="true">{% if o.selected %}☑{% else %}☐{% endif %}</span>
|
||||
<span class="attempt-review-option__body">{{ o.text }}{% if o.isCorrect %}<span class="attempt-review-option__tag">верный ответ</span>{% endif %}</span>
|
||||
</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
@@ -115,12 +115,14 @@
|
||||
class="form-input" style="width:90px;" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-3 grid gap-2 sm:grid-cols-3 items-end">
|
||||
<label class="inline-flex items-center gap-2 min-h-9">
|
||||
<div class="template-multi-row mt-3">
|
||||
<label class="inline-flex items-start gap-2 min-h-9 w-full">
|
||||
<input id="template-global-multi" type="checkbox"
|
||||
class="rounded border-ink-300 text-brand-600 focus:ring-brand-500" />
|
||||
<span class="text-sm">Несколько правильных ответов (все вопросы)</span>
|
||||
class="rounded border-ink-300 text-brand-600 focus:ring-brand-500 mt-0.5 shrink-0" />
|
||||
<span class="text-sm leading-snug">Несколько правильных ответов (все вопросы)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="template-correct-range-row mt-2 flex flex-wrap items-end gap-3">
|
||||
<label class="block">
|
||||
<span class="form-label">Правильных: от</span>
|
||||
<input id="template-min-correct" type="number" min="1" max="8" step="1" value="1"
|
||||
@@ -151,7 +153,7 @@
|
||||
</span>
|
||||
</summary>
|
||||
<div class="cabinet-disclosure__body">
|
||||
<section class="rounded-2xl bg-brand-50/60 border border-brand-100 p-4 sm:p-5 test-detail-ai-panel">
|
||||
<section class="rounded-2xl bg-brand-50/60 border border-brand-100 test-detail-ai-panel editor-generation-panel">
|
||||
|
||||
{# ── Заполнить через ИИ по теме ──────────────────────────── #}
|
||||
<div class="question-editor-block question-editor-block--first">
|
||||
@@ -168,11 +170,21 @@
|
||||
Сгенерировать вопросы (ИИ)
|
||||
</button>
|
||||
</div>
|
||||
<ul class="editor-generation-panel__notes mt-2 text-xs text-ink-500 space-y-1 list-disc pl-4 leading-snug">
|
||||
<li>Если в параметрах включены подсказки — после генерации будут созданы и тексты подсказок (черновик сохранится автоматически).</li>
|
||||
<li>Если уже есть версия с заполненным тестом — после «Сгенерировать» и сохранения весь прежний текст останется в старой версии в блоке «Версии».</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{# ── Проверить и улучшить ─────────────────────────────────── #}
|
||||
<div class="question-editor-block">
|
||||
<h3 class="test-detail-subsection__title">Проверить и улучшить</h3>
|
||||
<p class="text-xs text-ink-500 leading-snug mb-2">
|
||||
<span class="font-medium text-ink-600">Проверить тест</span> — ИИ прочитает вопросы и варианты и вернёт краткий вердикт и список замечаний; черновик не меняется.
|
||||
</p>
|
||||
<p class="text-xs text-ink-500 leading-snug mb-3">
|
||||
<span class="font-medium text-ink-600">Предложить улучшение</span> — ИИ предложит правки по каждому вопросу (было → стало); вы отметите, что применить к черновику.
|
||||
</p>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button id="ai-check"
|
||||
class="btn btn-ghost" type="button" style="min-height:43px;">
|
||||
@@ -190,6 +202,9 @@
|
||||
{# ── Документ в вопросы ──────────────────────────────────── #}
|
||||
<div class="question-editor-block test-detail-subsection test-detail-subsection--import">
|
||||
<h3 class="test-detail-subsection__title">Документ в вопросы</h3>
|
||||
<p class="text-xs text-ink-500 leading-snug mb-2">
|
||||
<span class="font-medium text-ink-600">Сгенерировать из документа</span> — из файла извлекается текст; ИИ составляет вопросы по содержанию и шаблону из «Параметров» (число вопросов, вариантов, несколько верных и т.д.), с учётом поля «Пожелания», если оно заполнено. Перед заменой откроется предпросмотр: «Применить» подставит черновик вместо текущих вопросов; дальше сохраните тест на сервер — подсказки и версии ведут себя так же, как при генерации по теме.
|
||||
</p>
|
||||
<label id="ai-import-dropzone"
|
||||
class="import-dropzone mt-2 flex flex-col w-full items-center justify-center gap-1
|
||||
px-4 py-5 rounded-xl bg-white border-2 border-dashed border-ink-300/70
|
||||
@@ -223,7 +238,7 @@
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<p id="ai-status" class="mt-3 text-sm text-ink-500 min-h-[1.25rem]"></p>
|
||||
<p id="ai-status" class="editor-generation-panel__status text-sm text-ink-500"></p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user