feat(tests): общие тесты с автором, в истории только результаты ученика (для всех ролей)

Made-with: Cursor
This commit is contained in:
Константин Лебединский
2026-04-01 23:09:17 +05:00
parent d8805bd4ed
commit 35f27a6eb7
4 changed files with 79 additions and 19 deletions
+10 -2
View File
@@ -17,6 +17,7 @@ interface Test {
questions: string;
createdAt: string;
results: TestResult[];
author?: { username: string; displayName: string | null };
}
interface TestResult {
@@ -248,7 +249,9 @@ export default function TestPage() {
<div className="space-y-6">
<div>
<h1 className="text-xl font-semibold tracking-tight">Тестирование</h1>
<p className="text-sm text-muted-foreground mt-1">Проверьте знания 10 вопросов с вариантами ответов</p>
<p className="text-sm text-muted-foreground mt-1">
Проверьте знания 10 вопросов с вариантами ответов. Тесты общие для пары; в истории только попытки ученика (видны всем).
</p>
</div>
<div className="grid grid-cols-2 gap-3">
@@ -298,8 +301,13 @@ export default function TestPage() {
</h2>
{tests.map((t) => (
<div key={t.id} className="flex items-center justify-between p-3.5 rounded-xl border text-sm">
<div>
<div className="min-w-0">
<span className="font-medium">{t.topic}</span>
{t.author && (
<span className="text-xs text-muted-foreground ml-2">
· автор: {t.author.displayName?.trim() || t.author.username}
</span>
)}
<span className="text-xs text-muted-foreground ml-2">
{new Date(t.createdAt).toLocaleDateString("ru")}
</span>