Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Improve metrics integration test coverage #9306

Merged
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9dfef93
+Enabled shouldReturnAverageScores() test
raffifasaro Sep 5, 2024
520571d
+shouldReturnCategories() test
raffifasaro Sep 10, 2024
78c0daa
Merge remote-tracking branch 'origin/develop' into chore/learning-ana…
raffifasaro Sep 11, 2024
5ab6ddf
+ shouldReturnTeamId() test
raffifasaro Sep 11, 2024
487e291
Merge remote-tracking branch 'origin/develop' into chore/learning-ana…
raffifasaro Sep 12, 2024
1c48a08
Merge fix
raffifasaro Sep 12, 2024
dfb6b15
Score test fix
raffifasaro Sep 12, 2024
88eb745
Some fixes
raffifasaro Sep 13, 2024
7c46d4f
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Sep 13, 2024
387a22b
fix Score test
raffifasaro Sep 14, 2024
e31e5fb
fix Completed Test
raffifasaro Sep 14, 2024
31d97f1
fix AverageScore Test
raffifasaro Sep 14, 2024
8d140de
remove CourseUtilService changes
raffifasaro Sep 14, 2024
19b5f9f
Fixed CompetencyInformation test
raffifasaro Sep 14, 2024
5484e11
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Sep 15, 2024
b6932b6
Added ExerciseTestRepository
raffifasaro Sep 16, 2024
557ba36
code improvements
raffifasaro Sep 16, 2024
8efbfd0
code review fixes
raffifasaro Sep 17, 2024
a800f5c
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Sep 17, 2024
91f5e94
Merge remote-tracking branch 'origin/develop' into chore/learning-ana…
raffifasaro Sep 20, 2024
ae410d7
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Sep 20, 2024
8097510
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Sep 22, 2024
db4dec4
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Sep 27, 2024
67404e3
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Sep 28, 2024
435ea12
Merge remote-tracking branch 'origin/develop' into chore/learning-ana…
raffifasaro Sep 30, 2024
f0da21e
resolve merge conflicts
raffifasaro Sep 30, 2024
d51b4b7
Apply suggestions from code review
raffifasaro Oct 1, 2024
272b155
fix israted error
raffifasaro Oct 1, 2024
a050d9a
Apply suggestions from code review
raffifasaro Oct 1, 2024
45f39d4
change fixes
raffifasaro Oct 1, 2024
921483e
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Oct 1, 2024
663c231
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
MaximilianAnzinger Oct 4, 2024
28850fb
replace exercise repository by test repository in tests
MaximilianAnzinger Oct 4, 2024
136d987
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Oct 5, 2024
3e848fa
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Oct 7, 2024
46597a7
requested change fix
raffifasaro Oct 7, 2024
bc729ea
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Oct 8, 2024
61bd9e7
Merge branch 'develop' into chore/learning-analytics/improve-metrics-…
raffifasaro Oct 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.cit.aet.artemis.atlas.domain.competency.Competency;
import de.tum.cit.aet.artemis.atlas.domain.competency.CompetencyTaxonomy;

/**
Expand All @@ -19,4 +20,15 @@
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record CompetencyInformationDTO(long id, String title, String description, CompetencyTaxonomy taxonomy, ZonedDateTime softDueDate, boolean optional, int masteryThreshold) {

/**
* Creates a CompetencyInformationDTO from a Competency.
raffifasaro marked this conversation as resolved.
Show resolved Hide resolved
*
* @param competency the Competency to create the DTO from
* @return the created DTO
*/
public static <C extends Competency> CompetencyInformationDTO of(C competency) {
return new CompetencyInformationDTO(competency.getId(), competency.getTitle(), competency.getDescription(), competency.getTaxonomy(), competency.getSoftDueDate(),
competency.isOptional(), competency.getMasteryThreshold());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,15 @@
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record LectureUnitInformationDTO(long id, long lectureId, String lectureTitle, String name, ZonedDateTime releaseDate, Class<? extends LectureUnit> type) {

/**
* Creates a LectureUnitInformationDTO from a LectureUnit.
raffifasaro marked this conversation as resolved.
Show resolved Hide resolved
*
* @param lectureUnit the LectureUnit to create the DTO from
* @return the created DTO
*/
public static <L extends LectureUnit> LectureUnitInformationDTO of(L lectureUnit) {
return new LectureUnitInformationDTO(lectureUnit.getId(), lectureUnit.getLecture().getId(), lectureUnit.getLecture().getTitle(), lectureUnit.getName(),
lectureUnit.getReleaseDate(), lectureUnit.getClass());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import de.tum.cit.aet.artemis.exercise.domain.IncludedInOverallScore;
import de.tum.cit.aet.artemis.exercise.domain.participation.StudentParticipation;
import de.tum.cit.aet.artemis.exercise.participation.util.ParticipationUtilService;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.exercise.test_repository.StudentParticipationTestRepository;
import de.tum.cit.aet.artemis.plagiarism.domain.PlagiarismVerdict;
import de.tum.cit.aet.artemis.quiz.domain.QuizExercise;
Expand All @@ -45,9 +44,6 @@ class CourseScoreCalculationServiceTest extends AbstractSpringIntegrationIndepen

private static final String TEST_PREFIX = "cscservicetest";

@Autowired
private ExerciseRepository exerciseRepository;

@Autowired
private StudentParticipationTestRepository studentParticipationRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ public void createStudentScore(Exercise exercise, User user, double score) {
studentScoreRepository.save(studentScore);
}

/**
* Creates rated and normal score (which are set equal) for given exercise and user.
*
* @param exercise the exercise to link the student score to
* @param user the user that is linked to the score
* @param score the score and rated score that the specified user has reached for the given exercise
*/
public void createRatedStudentScore(Exercise exercise, User user, double score) {
final var studentScore = new StudentScore();
studentScore.setExercise(exercise);
studentScore.setUser(user);
studentScore.setLastScore(score);
studentScore.setLastPoints(exercise.getMaxPoints() * score / 100);
studentScore.setLastRatedScore(score);
studentScoreRepository.save(studentScore);
}

/**
* Creates student score for given exercise and user.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import de.tum.cit.aet.artemis.core.domain.Course;
import de.tum.cit.aet.artemis.core.domain.User;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseTestRepository;
import de.tum.cit.aet.artemis.lecture.domain.LectureUnit;
import de.tum.cit.aet.artemis.lecture.repository.LectureUnitRepository;

Expand All @@ -35,7 +35,7 @@ public class CompetencyUtilService {
private LectureUnitRepository lectureUnitRepository;

@Autowired
private ExerciseRepository exerciseRepository;
private ExerciseTestRepository exerciseRepository;

@Autowired
private CompetencyRelationRepository competencyRelationRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import de.tum.cit.aet.artemis.core.util.CourseUtilService;
import de.tum.cit.aet.artemis.exercise.domain.DifficultyLevel;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.lecture.domain.Lecture;
import de.tum.cit.aet.artemis.lecture.domain.LectureUnit;
import de.tum.cit.aet.artemis.lecture.repository.LectureUnitRepository;
Expand Down Expand Up @@ -80,9 +79,6 @@ class LearningPathServiceTest extends AbstractSpringIntegrationIndependentTest {
@Autowired
private CompetencyProgressUtilService competencyProgressUtilService;

@Autowired
private ExerciseRepository exerciseRepository;

@Autowired
private StudentScoreUtilService studentScoreUtilService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import de.tum.cit.aet.artemis.exam.repository.ExamRepository;
import de.tum.cit.aet.artemis.exam.util.ExamUtilService;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.lecture.domain.Attachment;
import de.tum.cit.aet.artemis.lecture.domain.Lecture;
import de.tum.cit.aet.artemis.programming.domain.ProgrammingExercise;
Expand All @@ -82,9 +81,6 @@ class GroupNotificationServiceTest extends AbstractSpringIntegrationIndependentT
@Autowired
private NotificationSettingRepository notificationSettingRepository;

@Autowired
private ExerciseRepository exerciseRepository;

@Autowired
private ExamRepository examRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import de.tum.cit.aet.artemis.core.util.CourseUtilService;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.participation.util.ParticipationUtilService;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.shared.base.AbstractSpringIntegrationLocalCILocalVCTest;
import de.tum.cit.aet.artemis.text.domain.TextSubmission;
import de.tum.cit.aet.artemis.text.util.TextExerciseFactory;
Expand All @@ -44,9 +43,6 @@ class NotificationScheduleServiceTest extends AbstractSpringIntegrationLocalCILo
@Autowired
private InstanceMessageReceiveService instanceMessageReceiveService;

@Autowired
private ExerciseRepository exerciseRepository;

@Autowired
private NotificationRepository notificationRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
import de.tum.cit.aet.artemis.core.util.CourseUtilService;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.participation.util.ParticipationUtilService;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.fileupload.domain.FileUploadExercise;
import de.tum.cit.aet.artemis.fileupload.util.FileUploadExerciseUtilService;
import de.tum.cit.aet.artemis.lecture.domain.Lecture;
Expand Down Expand Up @@ -118,9 +117,6 @@ class SingleUserNotificationServiceTest extends AbstractSpringIntegrationIndepen
@Autowired
private NotificationSettingRepository notificationSettingRepository;

@Autowired
private ExerciseRepository exerciseRepository;

@Autowired
private ResultTestRepository resultRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import de.tum.cit.aet.artemis.core.util.CourseUtilService;
import de.tum.cit.aet.artemis.exercise.domain.DifficultyLevel;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.shared.base.AbstractSpringIntegrationIndependentTest;
import de.tum.cit.aet.artemis.text.util.TextExerciseFactory;

Expand All @@ -40,9 +39,6 @@ class EmailSummaryServiceTest extends AbstractSpringIntegrationIndependentTest {
@Autowired
private EmailSummaryService weeklyEmailSummaryService;

@Autowired
private ExerciseRepository exerciseRepository;

@Autowired
private NotificationSettingRepository notificationSettingRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import de.tum.cit.aet.artemis.core.user.util.UserUtilService;
import de.tum.cit.aet.artemis.core.util.CourseFactory;
import de.tum.cit.aet.artemis.core.util.CourseUtilService;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseTestRepository;
import de.tum.cit.aet.artemis.exercise.util.ExerciseUtilService;
import de.tum.cit.aet.artemis.lecture.domain.Lecture;
import de.tum.cit.aet.artemis.lecture.repository.LectureRepository;
Expand All @@ -64,7 +64,7 @@ public class ConversationUtilService {
private CourseTestRepository courseRepo;

@Autowired
private ExerciseRepository exerciseRepo;
private ExerciseTestRepository exerciseRepo;

@Autowired
private LectureRepository lectureRepo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import de.tum.cit.aet.artemis.core.test_repository.UserTestRepository;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
import de.tum.cit.aet.artemis.exercise.domain.participation.StudentParticipation;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseRepository;
import de.tum.cit.aet.artemis.exercise.repository.ExerciseTestRepository;
import de.tum.cit.aet.artemis.lti.config.Lti13TokenRetriever;
import de.tum.cit.aet.artemis.lti.domain.LtiPlatformConfiguration;
import de.tum.cit.aet.artemis.lti.domain.LtiResourceLaunch;
Expand All @@ -78,7 +78,7 @@ class Lti13ServiceTest {
private UserTestRepository userRepository;

@Mock
private ExerciseRepository exerciseRepository;
private ExerciseTestRepository exerciseRepository;

@Mock
private CourseTestRepository courseRepository;
Expand Down
Loading
Loading