use of de.tum.in.www1.artemis.web.rest.dto.IndividualLearningGoalProgress in project ArTEMiS by ls1intum.
the class LearningGoalIntegrationTest method getLearningGoalProgress_asStudent1_shouldReturnProgressTenOutOfTwenty.
@Test
@WithMockUser(username = "student1", roles = "USER")
public void getLearningGoalProgress_asStudent1_shouldReturnProgressTenOutOfTwenty() throws Exception {
IndividualLearningGoalProgress individualLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/individual-progress", HttpStatus.OK, IndividualLearningGoalProgress.class);
assertThat(individualLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
assertThat(individualLearningGoalProgress.pointsAchievedByStudentInLearningGoal).isEqualTo(10.0);
}
use of de.tum.in.www1.artemis.web.rest.dto.IndividualLearningGoalProgress in project ArTEMiS by ls1intum.
the class LearningGoalIntegrationTest method getLearningGoalProgress_asTeam1Student1_usingParticipantScores_shouldReturnProgressTenOutOfThirty.
@Test
@WithMockUser(username = "team1student1", roles = "USER")
public void getLearningGoalProgress_asTeam1Student1_usingParticipantScores_shouldReturnProgressTenOutOfThirty() throws Exception {
IndividualLearningGoalProgress individualLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/individual-progress?useParticipantScoreTable=true", HttpStatus.OK, IndividualLearningGoalProgress.class);
assertThat(individualLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
assertThat(individualLearningGoalProgress.pointsAchievedByStudentInLearningGoal).isEqualTo(5.0);
}
use of de.tum.in.www1.artemis.web.rest.dto.IndividualLearningGoalProgress in project Artemis by ls1intum.
the class LearningGoalIntegrationTest method getLearningGoalProgress_asStudent1_shouldReturnProgressTenOutOfTwenty.
@Test
@WithMockUser(username = "student1", roles = "USER")
public void getLearningGoalProgress_asStudent1_shouldReturnProgressTenOutOfTwenty() throws Exception {
IndividualLearningGoalProgress individualLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/individual-progress", HttpStatus.OK, IndividualLearningGoalProgress.class);
assertThat(individualLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
assertThat(individualLearningGoalProgress.pointsAchievedByStudentInLearningGoal).isEqualTo(10.0);
}
use of de.tum.in.www1.artemis.web.rest.dto.IndividualLearningGoalProgress in project Artemis by ls1intum.
the class LearningGoalService method calculateLearningGoalProgress.
/**
* Calculate the progress in a learning goal for a specific user
*
* @param learningGoal learning goal to get the progress for
* @param user user to get the progress for
* @param useParticipantScoreTable use the participant score table instead of going through participation -> submission -> result
* @return progress of the user in the learning goal
*/
public IndividualLearningGoalProgress calculateLearningGoalProgress(LearningGoal learningGoal, User user, boolean useParticipantScoreTable) {
IndividualLearningGoalProgress individualLearningGoalProgress = new IndividualLearningGoalProgress();
individualLearningGoalProgress.studentId = user.getId();
individualLearningGoalProgress.learningGoalId = learningGoal.getId();
individualLearningGoalProgress.learningGoalTitle = learningGoal.getTitle();
individualLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal = 0.0;
individualLearningGoalProgress.pointsAchievedByStudentInLearningGoal = 0.0;
// The progress will be calculated from a subset of the connected lecture units (currently only from released exerciseUnits)
Set<ExerciseUnit> exerciseUnitsUsableForProgressCalculation = learningGoal.getLectureUnits().parallelStream().filter(LectureUnit::isVisibleToStudents).filter(lectureUnit -> lectureUnit instanceof ExerciseUnit).map(lectureUnit -> (ExerciseUnit) lectureUnit).collect(Collectors.toSet());
Set<IndividualLearningGoalProgress.IndividualLectureUnitProgress> progressInLectureUnits = this.calculateExerciseUnitsProgress(exerciseUnitsUsableForProgressCalculation, user, useParticipantScoreTable);
// updating learningGoalPerformance by summing up the points of the individual lecture unit performances
individualLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal = progressInLectureUnits.stream().map(individualLectureUnitProgress -> individualLectureUnitProgress.totalPointsAchievableByStudentsInLectureUnit).reduce(0.0, Double::sum);
individualLearningGoalProgress.pointsAchievedByStudentInLearningGoal = progressInLectureUnits.stream().map(individualLectureUnitProgress -> (individualLectureUnitProgress.scoreAchievedByStudentInLectureUnit / 100.0) * individualLectureUnitProgress.totalPointsAchievableByStudentsInLectureUnit).reduce(0.0, Double::sum);
individualLearningGoalProgress.progressInLectureUnits = new ArrayList<>(progressInLectureUnits);
return individualLearningGoalProgress;
}
use of de.tum.in.www1.artemis.web.rest.dto.IndividualLearningGoalProgress in project ArTEMiS by ls1intum.
the class LearningGoalService method calculateLearningGoalProgress.
/**
* Calculate the progress in a learning goal for a specific user
*
* @param learningGoal learning goal to get the progress for
* @param user user to get the progress for
* @param useParticipantScoreTable use the participant score table instead of going through participation -> submission -> result
* @return progress of the user in the learning goal
*/
public IndividualLearningGoalProgress calculateLearningGoalProgress(LearningGoal learningGoal, User user, boolean useParticipantScoreTable) {
IndividualLearningGoalProgress individualLearningGoalProgress = new IndividualLearningGoalProgress();
individualLearningGoalProgress.studentId = user.getId();
individualLearningGoalProgress.learningGoalId = learningGoal.getId();
individualLearningGoalProgress.learningGoalTitle = learningGoal.getTitle();
individualLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal = 0.0;
individualLearningGoalProgress.pointsAchievedByStudentInLearningGoal = 0.0;
// The progress will be calculated from a subset of the connected lecture units (currently only from released exerciseUnits)
Set<ExerciseUnit> exerciseUnitsUsableForProgressCalculation = learningGoal.getLectureUnits().parallelStream().filter(LectureUnit::isVisibleToStudents).filter(lectureUnit -> lectureUnit instanceof ExerciseUnit).map(lectureUnit -> (ExerciseUnit) lectureUnit).collect(Collectors.toSet());
Set<IndividualLearningGoalProgress.IndividualLectureUnitProgress> progressInLectureUnits = this.calculateExerciseUnitsProgress(exerciseUnitsUsableForProgressCalculation, user, useParticipantScoreTable);
// updating learningGoalPerformance by summing up the points of the individual lecture unit performances
individualLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal = progressInLectureUnits.stream().map(individualLectureUnitProgress -> individualLectureUnitProgress.totalPointsAchievableByStudentsInLectureUnit).reduce(0.0, Double::sum);
individualLearningGoalProgress.pointsAchievedByStudentInLearningGoal = progressInLectureUnits.stream().map(individualLectureUnitProgress -> (individualLectureUnitProgress.scoreAchievedByStudentInLectureUnit / 100.0) * individualLectureUnitProgress.totalPointsAchievableByStudentsInLectureUnit).reduce(0.0, Double::sum);
individualLearningGoalProgress.progressInLectureUnits = new ArrayList<>(progressInLectureUnits);
return individualLearningGoalProgress;
}
Aggregations