Search in sources :

Example 1 with ExerciseScoresAggregatedInformation

use of de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresAggregatedInformation in project Artemis by ls1intum.

the class ExerciseScoresChartService method createExerciseScoreDTO.

private ExerciseScoresDTO createExerciseScoreDTO(Map<Long, ExerciseScoresAggregatedInformation> exerciseIdToAggregatedInformation, Map<Long, StudentScore> individualExerciseIdToStudentScore, Map<Long, TeamScore> teamExerciseIdToTeamScore, Exercise exercise) {
    ExerciseScoresDTO exerciseScoresDTO = new ExerciseScoresDTO(exercise);
    ExerciseScoresAggregatedInformation aggregatedInformation = exerciseIdToAggregatedInformation.get(exercise.getId());
    if (aggregatedInformation == null || aggregatedInformation.getAverageScoreAchieved() == null || aggregatedInformation.getMaxScoreAchieved() == null) {
        exerciseScoresDTO.averageScoreAchieved = 0D;
        exerciseScoresDTO.maxScoreAchieved = 0D;
    } else {
        exerciseScoresDTO.averageScoreAchieved = roundScoreSpecifiedByCourseSettings(aggregatedInformation.getAverageScoreAchieved(), exercise.getCourseViaExerciseGroupOrCourseMember());
        exerciseScoresDTO.maxScoreAchieved = roundScoreSpecifiedByCourseSettings(aggregatedInformation.getMaxScoreAchieved(), exercise.getCourseViaExerciseGroupOrCourseMember());
    }
    ParticipantScore participantScore = exercise.getMode().equals(ExerciseMode.INDIVIDUAL) ? individualExerciseIdToStudentScore.get(exercise.getId()) : teamExerciseIdToTeamScore.get(exercise.getId());
    exerciseScoresDTO.scoreOfStudent = participantScore == null || participantScore.getLastRatedScore() == null ? 0D : roundScoreSpecifiedByCourseSettings(participantScore.getLastScore(), exercise.getCourseViaExerciseGroupOrCourseMember());
    return exerciseScoresDTO;
}
Also used : ExerciseScoresAggregatedInformation(de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresAggregatedInformation) ParticipantScore(de.tum.in.www1.artemis.domain.scores.ParticipantScore) ExerciseScoresDTO(de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresDTO)

Example 2 with ExerciseScoresAggregatedInformation

use of de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresAggregatedInformation in project ArTEMiS by ls1intum.

the class ExerciseScoresChartService method createExerciseScoreDTO.

private ExerciseScoresDTO createExerciseScoreDTO(Map<Long, ExerciseScoresAggregatedInformation> exerciseIdToAggregatedInformation, Map<Long, StudentScore> individualExerciseIdToStudentScore, Map<Long, TeamScore> teamExerciseIdToTeamScore, Exercise exercise) {
    ExerciseScoresDTO exerciseScoresDTO = new ExerciseScoresDTO(exercise);
    ExerciseScoresAggregatedInformation aggregatedInformation = exerciseIdToAggregatedInformation.get(exercise.getId());
    if (aggregatedInformation == null || aggregatedInformation.getAverageScoreAchieved() == null || aggregatedInformation.getMaxScoreAchieved() == null) {
        exerciseScoresDTO.averageScoreAchieved = 0D;
        exerciseScoresDTO.maxScoreAchieved = 0D;
    } else {
        exerciseScoresDTO.averageScoreAchieved = roundScoreSpecifiedByCourseSettings(aggregatedInformation.getAverageScoreAchieved(), exercise.getCourseViaExerciseGroupOrCourseMember());
        exerciseScoresDTO.maxScoreAchieved = roundScoreSpecifiedByCourseSettings(aggregatedInformation.getMaxScoreAchieved(), exercise.getCourseViaExerciseGroupOrCourseMember());
    }
    ParticipantScore participantScore = exercise.getMode().equals(ExerciseMode.INDIVIDUAL) ? individualExerciseIdToStudentScore.get(exercise.getId()) : teamExerciseIdToTeamScore.get(exercise.getId());
    exerciseScoresDTO.scoreOfStudent = participantScore == null || participantScore.getLastRatedScore() == null ? 0D : roundScoreSpecifiedByCourseSettings(participantScore.getLastScore(), exercise.getCourseViaExerciseGroupOrCourseMember());
    return exerciseScoresDTO;
}
Also used : ExerciseScoresAggregatedInformation(de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresAggregatedInformation) ParticipantScore(de.tum.in.www1.artemis.domain.scores.ParticipantScore) ExerciseScoresDTO(de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresDTO)

Aggregations

ParticipantScore (de.tum.in.www1.artemis.domain.scores.ParticipantScore)2 ExerciseScoresAggregatedInformation (de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresAggregatedInformation)2 ExerciseScoresDTO (de.tum.in.www1.artemis.web.rest.dto.ExerciseScoresDTO)2