Search in sources :

Example 1 with FeedbackType

use of de.tum.in.www1.artemis.domain.enumeration.FeedbackType in project Artemis by ls1intum.

the class DatabaseUtilService method checkFeedbackCorrectlyStored.

public void checkFeedbackCorrectlyStored(List<Feedback> sentFeedback, List<Feedback> storedFeedback, FeedbackType feedbackType) {
    assertThat(sentFeedback.size()).as("contains the same amount of feedback").isEqualTo(storedFeedback.size());
    Result storedFeedbackResult = new Result();
    Result sentFeedbackResult = new Result();
    storedFeedbackResult.setFeedbacks(storedFeedback);
    sentFeedbackResult.setFeedbacks(sentFeedback);
    Course course = new Course();
    course.setAccuracyOfScores(1);
    storedFeedbackResult.setParticipation(new StudentParticipation().exercise(new ProgrammingExercise().course(course)));
    sentFeedbackResult.setParticipation(new StudentParticipation().exercise(new ProgrammingExercise().course(course)));
    double calculatedTotalPoints = resultRepo.calculateTotalPoints(storedFeedback);
    double totalPoints = resultRepo.constrainToRange(calculatedTotalPoints, 20.0);
    storedFeedbackResult.setScore(totalPoints, 20.0);
    storedFeedbackResult.setResultString(totalPoints, 20.0);
    double calculatedTotalPoints2 = resultRepo.calculateTotalPoints(sentFeedback);
    double totalPoints2 = resultRepo.constrainToRange(calculatedTotalPoints2, 20.0);
    sentFeedbackResult.setScore(totalPoints2, 20.0);
    sentFeedbackResult.setResultString(totalPoints2, 20.0);
    assertThat(storedFeedbackResult.getScore()).as("stored feedback evaluates to the same score as sent feedback").isEqualTo(sentFeedbackResult.getScore());
    storedFeedback.forEach(feedback -> assertThat(feedback.getType()).as("type has been set correctly").isEqualTo(feedbackType));
}
Also used : TextPlagiarismResult(de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult) ModelingPlagiarismResult(de.tum.in.www1.artemis.domain.plagiarism.modeling.ModelingPlagiarismResult)

Example 2 with FeedbackType

use of de.tum.in.www1.artemis.domain.enumeration.FeedbackType in project ArTEMiS by ls1intum.

the class DatabaseUtilService method checkFeedbackCorrectlyStored.

public void checkFeedbackCorrectlyStored(List<Feedback> sentFeedback, List<Feedback> storedFeedback, FeedbackType feedbackType) {
    assertThat(sentFeedback.size()).as("contains the same amount of feedback").isEqualTo(storedFeedback.size());
    Result storedFeedbackResult = new Result();
    Result sentFeedbackResult = new Result();
    storedFeedbackResult.setFeedbacks(storedFeedback);
    sentFeedbackResult.setFeedbacks(sentFeedback);
    Course course = new Course();
    course.setAccuracyOfScores(1);
    storedFeedbackResult.setParticipation(new StudentParticipation().exercise(new ProgrammingExercise().course(course)));
    sentFeedbackResult.setParticipation(new StudentParticipation().exercise(new ProgrammingExercise().course(course)));
    double calculatedTotalPoints = resultRepo.calculateTotalPoints(storedFeedback);
    double totalPoints = resultRepo.constrainToRange(calculatedTotalPoints, 20.0);
    storedFeedbackResult.setScore(totalPoints, 20.0);
    storedFeedbackResult.setResultString(totalPoints, 20.0);
    double calculatedTotalPoints2 = resultRepo.calculateTotalPoints(sentFeedback);
    double totalPoints2 = resultRepo.constrainToRange(calculatedTotalPoints2, 20.0);
    sentFeedbackResult.setScore(totalPoints2, 20.0);
    sentFeedbackResult.setResultString(totalPoints2, 20.0);
    assertThat(storedFeedbackResult.getScore()).as("stored feedback evaluates to the same score as sent feedback").isEqualTo(sentFeedbackResult.getScore());
    storedFeedback.forEach(feedback -> assertThat(feedback.getType()).as("type has been set correctly").isEqualTo(feedbackType));
}
Also used : TextPlagiarismResult(de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult) ModelingPlagiarismResult(de.tum.in.www1.artemis.domain.plagiarism.modeling.ModelingPlagiarismResult)

Aggregations

ModelingPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.modeling.ModelingPlagiarismResult)2 TextPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult)2