Admin group: fix script loading (extra div), total submissions counter, label cleanup
This commit is contained in:
@@ -56,6 +56,13 @@ class SubmissionController(
|
||||
@RequestParam labId: UUID,
|
||||
): List<SubmissionDto> = submissions.latestPerStudent(labId)
|
||||
|
||||
/** Общее число решений (всех попыток) по лабораторной. */
|
||||
@GetMapping("/submissions/count")
|
||||
@PreAuthorize("hasAuthority('ROLE_ADMIN')")
|
||||
fun submissionCount(
|
||||
@RequestParam labId: UUID,
|
||||
): Map<String, Long> = mapOf("count" to submissions.countForLab(labId))
|
||||
|
||||
@GetMapping("/submissions/{id}/download")
|
||||
@PreAuthorize("hasAuthority('ROLE_ADMIN')")
|
||||
fun downloadForAdmin(
|
||||
|
||||
@@ -101,6 +101,10 @@ class SubmissionService(
|
||||
return zip to name
|
||||
}
|
||||
|
||||
/** Общее число решений (всех попыток) по лабораторной. */
|
||||
@Transactional(readOnly = true)
|
||||
fun countForLab(labId: UUID): Long = submissions.countByLabId(labId)
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
fun latestPerStudent(labId: UUID): List<SubmissionDto> {
|
||||
val perStudent = mutableMapOf<UUID, Submission>()
|
||||
|
||||
@@ -14,6 +14,8 @@ interface SubmissionRepository : JpaRepository<Submission, UUID> {
|
||||
|
||||
fun findByLabIdOrderByCreatedAtDesc(labId: UUID): List<Submission>
|
||||
|
||||
fun countByLabId(labId: UUID): Long
|
||||
|
||||
fun findFirstByStudentIdAndLabIdOrderBySeqDesc(
|
||||
studentId: UUID,
|
||||
labId: UUID,
|
||||
|
||||
Reference in New Issue
Block a user