use of de.tum.in.www1.artemis.domain.quiz in project ArTEMiS by ls1intum.
the class GitServiceIntTest method testListFiles.
@Test
public void testListFiles() throws IOException, GitAPIException {
Participation participation = new Participation();
participation.setRepositoryUrl(remoteTestRepo);
Repository repo = gitService.getOrCheckoutRepository(participation);
Collection<de.tum.in.www1.artemis.domain.File> files = gitService.listFiles(repo);
assertThat(files.size()).isGreaterThan(0);
gitService.deleteLocalRepository(repo);
}
use of de.tum.in.www1.artemis.domain.quiz in project ArTEMiS by ls1intum.
the class ParticipantScoreResource method getScoresOfExam.
/**
* GET /exams/:examId/exam-scores gets the exam scores of the exam
* <p>
* This method represents a server based way to calculate a students achieved points / score in an exam.
* <p>
* Currently both this server based calculation method and the traditional client side calculation method is used
* side-by-side in exam-scores.component.ts.
* <p>
* The goal is to switch completely to this much faster server based calculation if the {@link de.tum.in.www1.artemis.service.listeners.ResultListener}
* has been battle tested enough.
*
* @param examId the id of the exam for which to calculate the exam scores
* @return list of scores for every registered user in the xam
*/
@GetMapping("/exams/{examId}/exam-scores")
@PreAuthorize("hasRole('INSTRUCTOR')")
public ResponseEntity<List<ScoreDTO>> getScoresOfExam(@PathVariable Long examId) {
long start = System.currentTimeMillis();
log.debug("REST request to get exam scores for exam : {}", examId);
Exam exam = examRepository.findByIdWithRegisteredUsersExerciseGroupsAndExercisesElseThrow(examId);
authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, exam.getCourse(), null);
List<ScoreDTO> scoreDTOS = participantScoreService.calculateExamScores(exam);
log.info("getScoresOfExam took {}ms", System.currentTimeMillis() - start);
return ResponseEntity.ok().body(scoreDTOS);
}
use of de.tum.in.www1.artemis.domain.quiz in project ArTEMiS by ls1intum.
the class ParticipantScoreResource method getAverageScoreOfParticipantInCourse.
/**
* GET /courses/:courseId/participant-scores/average-participant gets the average scores of the participants in the course
* <p>
* Important: Exercises with {@link de.tum.in.www1.artemis.domain.enumeration.IncludedInOverallScore#NOT_INCLUDED} will be not taken into account!
*
* @param courseId the id of the course for which to get the average scores of the participants
* @return the ResponseEntity with status 200 (OK) and with the average scores in the body
*/
@GetMapping("/courses/{courseId}/participant-scores/average-participant")
@PreAuthorize("hasRole('INSTRUCTOR')")
public ResponseEntity<List<ParticipantScoreAverageDTO>> getAverageScoreOfParticipantInCourse(@PathVariable Long courseId) {
long start = System.currentTimeMillis();
log.debug("REST request to get average participant scores of participants for course : {}", courseId);
Course course = courseRepository.findByIdWithEagerExercisesElseThrow(courseId);
authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null);
Set<Exercise> exercisesOfCourse = course.getExercises().stream().filter(Exercise::isCourseExercise).filter(exercise -> !exercise.getIncludedInOverallScore().equals(IncludedInOverallScore.NOT_INCLUDED)).collect(toSet());
List<ParticipantScoreAverageDTO> resultsOfAllExercises = participantScoreService.getParticipantScoreAverageDTOs(exercisesOfCourse);
log.info("getAverageScoreOfStudentInCourse took {}ms", System.currentTimeMillis() - start);
return ResponseEntity.ok().body(resultsOfAllExercises);
}
use of de.tum.in.www1.artemis.domain.quiz in project Artemis by ls1intum.
the class ParticipantScoreResource method getScoresOfExam.
/**
* GET /exams/:examId/exam-scores gets the exam scores of the exam
* <p>
* This method represents a server based way to calculate a students achieved points / score in an exam.
* <p>
* Currently both this server based calculation method and the traditional client side calculation method is used
* side-by-side in exam-scores.component.ts.
* <p>
* The goal is to switch completely to this much faster server based calculation if the {@link de.tum.in.www1.artemis.service.listeners.ResultListener}
* has been battle tested enough.
*
* @param examId the id of the exam for which to calculate the exam scores
* @return list of scores for every registered user in the xam
*/
@GetMapping("/exams/{examId}/exam-scores")
@PreAuthorize("hasRole('INSTRUCTOR')")
public ResponseEntity<List<ScoreDTO>> getScoresOfExam(@PathVariable Long examId) {
long start = System.currentTimeMillis();
log.debug("REST request to get exam scores for exam : {}", examId);
Exam exam = examRepository.findByIdWithRegisteredUsersExerciseGroupsAndExercisesElseThrow(examId);
authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, exam.getCourse(), null);
List<ScoreDTO> scoreDTOS = participantScoreService.calculateExamScores(exam);
log.info("getScoresOfExam took {}ms", System.currentTimeMillis() - start);
return ResponseEntity.ok().body(scoreDTOS);
}
use of de.tum.in.www1.artemis.domain.quiz in project Artemis by ls1intum.
the class ParticipantScoreResource method getScoresOfCourse.
/**
* GET /courses/:courseId/course-scores gets the course scores of the course
* <p>
* This method represents a server based way to calculate a students achieved points / score in a course.
* <p>
* Currently both this server based calculation method and the traditional client side calculation method is used
* side-by-side in course-scores.component.ts.
* <p>
* The goal is to switch completely to this much faster server based calculation if the {@link de.tum.in.www1.artemis.service.listeners.ResultListener}
* has been battle tested enough.
*
* @param courseId the id of the course for which to calculate the course scores
* @return list of scores for every member of the course
*/
@GetMapping("/courses/{courseId}/course-scores")
@PreAuthorize("hasRole('INSTRUCTOR')")
public ResponseEntity<List<ScoreDTO>> getScoresOfCourse(@PathVariable Long courseId) {
long start = System.currentTimeMillis();
log.debug("REST request to get course scores for course : {}", courseId);
Course course = courseRepository.findByIdWithEagerExercisesElseThrow(courseId);
authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null);
List<ScoreDTO> scoreDTOS = participantScoreService.calculateCourseScores(course);
log.info("getScoresOfCourse took {}ms", System.currentTimeMillis() - start);
return ResponseEntity.ok().body(scoreDTOS);
}
Aggregations