Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
All services: admin-v2, studio-v2, website, ai-compliance-sdk, consent-service, klausur-service, voice-service, and infrastructure. Large PDFs and compiled binaries excluded via .gitignore.
69 lines
1.8 KiB
Python
69 lines
1.8 KiB
Python
"""
|
|
Klausur-Service Exam Models
|
|
|
|
Data classes for Klausur and StudentKlausur.
|
|
"""
|
|
|
|
from dataclasses import dataclass, asdict
|
|
from datetime import datetime
|
|
from typing import Optional, List, Dict, Any
|
|
|
|
from .enums import KlausurModus, StudentKlausurStatus
|
|
|
|
|
|
@dataclass
|
|
class StudentKlausur:
|
|
"""A student's exam work."""
|
|
id: str
|
|
klausur_id: str
|
|
student_name: str
|
|
student_id: Optional[str]
|
|
file_path: Optional[str]
|
|
ocr_text: Optional[str]
|
|
status: StudentKlausurStatus
|
|
criteria_scores: Dict[str, Dict]
|
|
gutachten: Optional[Dict]
|
|
raw_points: int
|
|
grade_points: int
|
|
created_at: datetime
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
"""Convert to dictionary for JSON serialization."""
|
|
d = asdict(self)
|
|
d['status'] = self.status.value if hasattr(self.status, 'value') else self.status
|
|
d['created_at'] = self.created_at.isoformat()
|
|
return d
|
|
|
|
|
|
@dataclass
|
|
class Klausur:
|
|
"""An exam/Klausur with associated student works."""
|
|
id: str
|
|
title: str
|
|
subject: str
|
|
modus: KlausurModus
|
|
class_id: Optional[str]
|
|
year: int
|
|
semester: str
|
|
erwartungshorizont: Optional[Dict]
|
|
students: List[StudentKlausur]
|
|
created_at: datetime
|
|
teacher_id: str
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
"""Convert to dictionary for JSON serialization."""
|
|
return {
|
|
'id': self.id,
|
|
'title': self.title,
|
|
'subject': self.subject,
|
|
'modus': self.modus.value,
|
|
'class_id': self.class_id,
|
|
'year': self.year,
|
|
'semester': self.semester,
|
|
'erwartungshorizont': self.erwartungshorizont,
|
|
'student_count': len(self.students),
|
|
'students': [s.to_dict() for s in self.students],
|
|
'created_at': self.created_at.isoformat(),
|
|
'teacher_id': self.teacher_id
|
|
}
|