improve exam trans

This commit is contained in:
xiaomlove
2024-06-27 03:29:03 +08:00
parent b0fb0513ea
commit 285e1061ce
7 changed files with 48 additions and 15 deletions

View File

@@ -275,6 +275,15 @@ class Exam extends NexusModel
};
}
public function getPassResultTransKey(string $result): string
{
return match ($this->type) {
self::TYPE_EXAM => "exam.result_{$result}_for_exam",
self::TYPE_TASK => "exam.result_{$result}_for_task",
default => throw new \RuntimeException("Invalid type: " . $this->type)
};
}
public function isTypeExam(): bool
{
return $this->type == self::TYPE_EXAM;