Muttersprache koppeln und russischen A1-Kurs ergänzen
GUI und neue Erklärungen verwenden gemeinsam native_language. Deutsch und Russisch sind die beiden Muttersprachen; Englisch bleibt die Lernsprache. Kompatibilitätsfelder werden atomar gekoppelt, widersprüchliche Eingaben abgewiesen und bestehende Profile sowie eingefrorene Inhalte erhalten. Ergänzt vollständige russische GUI-Kataloge und 840 geprüfte Aufgabenansichten in sieben Modulen einschließlich A1-Test, mit getrennten Sprachrollen für Ausgangs- und Lernmaterial. Äquivalente Ansichten teilen ihre Nachweisidentität. Stabile API-Fehlercodes, neue deterministische Hilfen und Trainingsbegründungen berücksichtigen die Muttersprache. Dokumentiert das Sprachmodell in AGENTS.md. Validierung: Go-Race-Suite mit eigener lokaler PostgreSQL-Testdatenbank, go vet, Web-Build, Offline-Bank-/Variantenaudit, Diff-Prüfung sowie lokale Browser-Smokes für Sprachen, Kurs, Administration, Aussprache und Aufnahme. Keine Live-Anbieter, Produktionsprofile, Deployment-Schritte oder historischen Neubewertungen.
This commit is contained in:
@@ -389,7 +389,7 @@ func (s *AdaptiveStore) AssignBankTask(ctx context.Context, j domain.CourseJob)
|
||||
t.CanonicalTaskID = chosen.bankEntryID
|
||||
}
|
||||
// Reuse the earliest evidence identity without editing any historic snapshot.
|
||||
err = tx.QueryRowContext(ctx, `SELECT COALESCE(NULLIF(data->>'evidence_task_id',''),id) FROM course_v2_tasks WHERE owner_id=$1 AND language=$2 AND version=$3 AND exam_id IS NULL AND COALESCE(NULLIF(data->>'canonical_task_id',''),bank_entry_id)=$4 ORDER BY created_at,id LIMIT 1`, j.UserID, j.Language, domain.CourseVersion, t.CanonicalTaskID).Scan(&t.EvidenceTaskID)
|
||||
err = tx.QueryRowContext(ctx, `SELECT COALESCE(NULLIF(data->>'evidence_task_id',''),id) FROM course_v2_tasks WHERE owner_id=$1 AND language=$2 AND version=$3 AND COALESCE(NULLIF(data->>'canonical_task_id',''),bank_entry_id)=$4 ORDER BY created_at,id LIMIT 1`, j.UserID, j.Language, domain.CourseVersion, t.CanonicalTaskID).Scan(&t.EvidenceTaskID)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
t.EvidenceTaskID = t.ID
|
||||
} else if err != nil {
|
||||
@@ -415,8 +415,12 @@ func (s *AdaptiveStore) AssignBankTask(ctx context.Context, j domain.CourseJob)
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (s *AdaptiveStore) BankExam(ctx context.Context, user, language, module string) ([]domain.AdaptiveTask, error) {
|
||||
func (s *AdaptiveStore) BankExam(ctx context.Context, user, language, module string, native ...string) ([]domain.AdaptiveTask, error) {
|
||||
out := []domain.AdaptiveTask{}
|
||||
mother := "de-DE"
|
||||
if len(native) > 0 && native[0] != "" {
|
||||
mother = native[0]
|
||||
}
|
||||
mods, err := s.Modules(ctx, language)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -428,7 +432,7 @@ func (s *AdaptiveStore) BankExam(ctx context.Context, user, language, module str
|
||||
for n := 0; n < 2; n++ {
|
||||
origin := mods[(i+n+1)%6].Key
|
||||
var data []byte
|
||||
err = s.db.QueryRowContext(ctx, `SELECT b.data FROM course_v2_bank b WHERE b.active AND b.language=$1 AND b.version=$2 AND b.module_id=$3 AND b.skill=$4 AND b.data->'task'->>'origin_module_key'=$5 ORDER BY (SELECT count(*) FROM course_v2_tasks t WHERE t.owner_id=$6 AND (t.bank_entry_id=b.id OR t.fingerprint='bank-exam:'||b.id)),md5(b.id||$6) LIMIT 1`, language, domain.CourseVersion, module, skill, origin, user).Scan(&data)
|
||||
err = s.db.QueryRowContext(ctx, availableBank+` SELECT av.entry FROM available av WHERE av.module_id=$5 AND av.skill=$6 AND av.entry->'task'->>'origin_module_key'=$7 ORDER BY (SELECT count(*) FROM course_v2_tasks t WHERE t.owner_id=$1 AND (t.bank_entry_id=av.base_id OR t.fingerprint='bank-exam:'||(CASE WHEN av.variant_id='' THEN av.base_id ELSE av.variant_id END))),md5((av.entry->>'id')||$1) LIMIT 1`, user, language, domain.CourseVersion, mother, module, skill, origin).Scan(&data)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
@@ -442,6 +446,12 @@ func (s *AdaptiveStore) BankExam(ctx context.Context, user, language, module str
|
||||
t := entry.Task
|
||||
t.Source = "curated"
|
||||
t.BriefID = entry.ID
|
||||
if t.CanonicalTaskID == "" {
|
||||
t.CanonicalTaskID = entry.ID
|
||||
}
|
||||
if t.InstructionLanguage == "" {
|
||||
t.InstructionLanguage = "de-DE"
|
||||
}
|
||||
out = append(out, t)
|
||||
}
|
||||
}
|
||||
@@ -483,6 +493,8 @@ func (s *AdaptiveStore) BankInventory(ctx context.Context, user, language string
|
||||
// Also repairs a crash between completing scores and storing the static summary.
|
||||
// Existing ready/historical summaries are not overwritten.
|
||||
func (s *AdaptiveStore) EnsureBankExamSummary(ctx context.Context, user, id string) error {
|
||||
_, err := s.db.ExecContext(ctx, `UPDATE course_v2_exams SET result=result||jsonb_build_object('summary',$3::text,'summary_status','ready') WHERE id=$1 AND user_id=$2 AND status='completed' AND result->>'summary_status'='pending'`, id, user, "Interne A1-Lerneinschätzung aus den gespeicherten Bewertungen. Kein Zertifikat.")
|
||||
_, err := s.db.ExecContext(ctx, `UPDATE course_v2_exams e SET result=result||jsonb_build_object('summary',CASE WHEN (SELECT t.data->>'instruction_language' FROM course_v2_tasks t WHERE t.owner_id=$2 AND t.exam_id=e.id ORDER BY t.id LIMIT 1)='ru-RU' THEN $3::text ELSE $4::text END,'summary_status','ready') WHERE e.id=$1 AND e.user_id=$2 AND e.status='completed' AND e.result->>'summary_status'='pending'`, id, user,
|
||||
"Внутренняя оценка уровня A1 на основе сохранённых результатов. Это не сертификат.",
|
||||
"Interne A1-Lerneinschätzung aus den gespeicherten Bewertungen. Kein Zertifikat.")
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user