use of de.tum.in.www1.artemis.web.rest.dto.CourseLearningGoalProgress in project Artemis by ls1intum.
the class LearningGoalIntegrationTest method getLearningGoalCourseProgressTeamsTest_asInstructorOne.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void getLearningGoalCourseProgressTeamsTest_asInstructorOne() throws Exception {
cleanUpInitialParticipations();
// will be ignored in favor of last submission from team
createParticipationSubmissionAndResult(idOfTeamTextExercise, teams.get(0), 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTeamTextExercise, teams.get(0), 10.0, 0.0, 50, false);
// will be ignored in favor of last submission from team
// will be ignored in favor of last submission from team
createParticipationSubmissionAndResult(idOfTeamTextExercise, teams.get(1), 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTeamTextExercise, teams.get(1), 10.0, 0.0, 10, false);
createParticipationSubmissionAndResult(idOfTeamTextExercise, teams.get(2), 10.0, 0.0, 10, true);
createParticipationSubmissionAndResult(idOfTeamTextExercise, teams.get(3), 10.0, 0.0, 50, true);
CourseLearningGoalProgress courseLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/course-progress", HttpStatus.OK, CourseLearningGoalProgress.class);
assertThat(courseLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
assertThat(courseLearningGoalProgress.averagePointsAchievedByStudentInLearningGoal).isEqualTo(3.0);
assertThatSpecificCourseLectureUnitProgressExists(courseLearningGoalProgress, 80.0, 4, 30);
}
use of de.tum.in.www1.artemis.web.rest.dto.CourseLearningGoalProgress in project ArTEMiS by ls1intum.
the class LearningGoalIntegrationTest method getLearningGoalCourseProgressIndividualTest_asInstructorOne_usingParticipantScoreTable.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void getLearningGoalCourseProgressIndividualTest_asInstructorOne_usingParticipantScoreTable() throws Exception {
cleanUpInitialParticipations();
User student1 = userRepository.findOneByLogin("student1").get();
User student2 = userRepository.findOneByLogin("student2").get();
User student3 = userRepository.findOneByLogin("student3").get();
User student4 = userRepository.findOneByLogin("student4").get();
User instructor1 = userRepository.findOneByLogin("instructor1").get();
// will be ignored in favor of last submission from team
createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 50, false);
// will be ignored in favor of last submission from student
createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 10, false);
createParticipationSubmissionAndResult(idOfTextExercise, student3, 10.0, 0.0, 10, true);
createParticipationSubmissionAndResult(idOfTextExercise, student4, 10.0, 0.0, 50, true);
// will be ignored as not a student
createParticipationSubmissionAndResult(idOfTextExercise, instructor1, 10.0, 0.0, 100, true);
CourseLearningGoalProgress courseLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/course-progress?useParticipantScoreTable=true", HttpStatus.OK, CourseLearningGoalProgress.class);
assertThat(courseLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
assertThat(courseLearningGoalProgress.averagePointsAchievedByStudentInLearningGoal).isEqualTo(3.0);
assertThatSpecificCourseLectureUnitProgressExists(courseLearningGoalProgress, 20.0, 4, 30.0);
}
use of de.tum.in.www1.artemis.web.rest.dto.CourseLearningGoalProgress in project Artemis by ls1intum.
the class LearningGoalResource method getLearningGoalProgressOfCourse.
/**
* GET /courses/:courseId/goals/:learningGoalId/course-progress gets the learning goal progress for the whole course
*
* @param courseId the id of the course to which the learning goal belongs
* @param learningGoalId the id of the learning goal for which to get the progress
* @param useParticipantScoreTable use the participant score table instead of going through participation -> submission -> result
* @return the ResponseEntity with status 200 (OK) and with the learning goal course performance in the body
*/
@GetMapping("/courses/{courseId}/goals/{learningGoalId}/course-progress")
@PreAuthorize("hasRole('INSTRUCTOR')")
public ResponseEntity<CourseLearningGoalProgress> getLearningGoalProgressOfCourse(@PathVariable Long learningGoalId, @PathVariable Long courseId, @RequestParam(defaultValue = "false", required = false) boolean useParticipantScoreTable) {
log.debug("REST request to get course progress for LearningGoal : {}", learningGoalId);
var learningGoal = findLearningGoal(Role.INSTRUCTOR, learningGoalId, courseId);
CourseLearningGoalProgress courseLearningGoalProgress = learningGoalService.calculateLearningGoalCourseProgress(learningGoal, useParticipantScoreTable);
return ResponseEntity.ok().body(courseLearningGoalProgress);
}
use of de.tum.in.www1.artemis.web.rest.dto.CourseLearningGoalProgress in project Artemis by ls1intum.
the class LearningGoalIntegrationTest method getLearningGoalCourseProgressIndividualTest_asInstructorOne.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void getLearningGoalCourseProgressIndividualTest_asInstructorOne() throws Exception {
cleanUpInitialParticipations();
User student1 = userRepository.findOneByLogin("student1").get();
User student2 = userRepository.findOneByLogin("student2").get();
User student3 = userRepository.findOneByLogin("student3").get();
User student4 = userRepository.findOneByLogin("student4").get();
User instructor1 = userRepository.findOneByLogin("instructor1").get();
// will be ignored in favor of last submission from team
createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 50, false);
// will be ignored in favor of last submission from student
createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 10, false);
createParticipationSubmissionAndResult(idOfTextExercise, student3, 10.0, 0.0, 10, true);
createParticipationSubmissionAndResult(idOfTextExercise, student4, 10.0, 0.0, 50, true);
// will be ignored as not a student
createParticipationSubmissionAndResult(idOfTextExercise, instructor1, 10.0, 0.0, 100, true);
CourseLearningGoalProgress courseLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/course-progress", HttpStatus.OK, CourseLearningGoalProgress.class);
assertThat(courseLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
assertThat(courseLearningGoalProgress.averagePointsAchievedByStudentInLearningGoal).isEqualTo(3.0);
assertThatSpecificCourseLectureUnitProgressExists(courseLearningGoalProgress, 20.0, 4, 30.0);
}
use of de.tum.in.www1.artemis.web.rest.dto.CourseLearningGoalProgress in project Artemis by ls1intum.
the class LearningGoalIntegrationTest method getLearningGoalCourseProgressIndividualTest_asInstructorOne_usingParticipantScoreTable.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void getLearningGoalCourseProgressIndividualTest_asInstructorOne_usingParticipantScoreTable() throws Exception {
cleanUpInitialParticipations();
User student1 = userRepository.findOneByLogin("student1").get();
User student2 = userRepository.findOneByLogin("student2").get();
User student3 = userRepository.findOneByLogin("student3").get();
User student4 = userRepository.findOneByLogin("student4").get();
User instructor1 = userRepository.findOneByLogin("instructor1").get();
// will be ignored in favor of last submission from team
createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 50, false);
// will be ignored in favor of last submission from student
createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 100, true);
createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 10, false);
createParticipationSubmissionAndResult(idOfTextExercise, student3, 10.0, 0.0, 10, true);
createParticipationSubmissionAndResult(idOfTextExercise, student4, 10.0, 0.0, 50, true);
// will be ignored as not a student
createParticipationSubmissionAndResult(idOfTextExercise, instructor1, 10.0, 0.0, 100, true);
CourseLearningGoalProgress courseLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/course-progress?useParticipantScoreTable=true", HttpStatus.OK, CourseLearningGoalProgress.class);
assertThat(courseLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
assertThat(courseLearningGoalProgress.averagePointsAchievedByStudentInLearningGoal).isEqualTo(3.0);
assertThatSpecificCourseLectureUnitProgressExists(courseLearningGoalProgress, 20.0, 4, 30.0);
}
Aggregations