Skip to content

Commit 994c555

Browse files
committed
change dto name to use the correct term repo name
1 parent cdd3569 commit 994c555

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed
+37-37
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import de.tum.cit.aet.artemis.programming.domain.ProgrammingSubmission;
2929

3030
@JsonInclude(JsonInclude.Include.NON_EMPTY)
31-
public record RepoIdentifierProgrammingStudentParticipationDTO(long id, ZonedDateTime individualDueDate, Set<RepoIdentifierSubmissionDTO> submissions, String participantName,
32-
String participantIdentifier, String repositoryUri, String buildPlanId, String branch, RepoIdentifierProgrammingExerciseDTO exercise) {
31+
public record RepoNameProgrammingStudentParticipationDTO(long id, ZonedDateTime individualDueDate, Set<RepoNameSubmissionDTO> submissions, String participantName,
32+
String participantIdentifier, String repositoryUri, String buildPlanId, String branch, RepoNameProgrammingExerciseDTO exercise) {
3333

3434
/**
3535
* Converts a ProgrammingExerciseStudentParticipation into a dto for the endpoint
@@ -38,19 +38,19 @@ public record RepoIdentifierProgrammingStudentParticipationDTO(long id, ZonedDat
3838
* @param participation to convert
3939
* @return the converted DTO
4040
*/
41-
public static RepoIdentifierProgrammingStudentParticipationDTO of(ProgrammingExerciseStudentParticipation participation) {
41+
public static RepoNameProgrammingStudentParticipationDTO of(ProgrammingExerciseStudentParticipation participation) {
4242
return Optional.ofNullable(participation)
43-
.map(p -> new RepoIdentifierProgrammingStudentParticipationDTO(p.getId(), p.getIndividualDueDate(),
44-
Optional.ofNullable(p.getSubmissions()).orElse(Set.of()).stream().filter(Objects::nonNull)
45-
.map(s -> RepoIdentifierSubmissionDTO.of((ProgrammingSubmission) s)).collect(Collectors.toSet()),
43+
.map(p -> new RepoNameProgrammingStudentParticipationDTO(p.getId(), p.getIndividualDueDate(),
44+
Optional.ofNullable(p.getSubmissions()).orElse(Set.of()).stream().filter(Objects::nonNull).map(s -> RepoNameSubmissionDTO.of((ProgrammingSubmission) s))
45+
.collect(Collectors.toSet()),
4646
p.getParticipantName(), p.getParticipantIdentifier(), p.getRepositoryUri(), p.getBuildPlanId(), p.getBranch(),
47-
RepoIdentifierProgrammingExerciseDTO.of(p.getProgrammingExercise())))
47+
RepoNameProgrammingExerciseDTO.of(p.getProgrammingExercise())))
4848
.orElse(null);
4949
}
5050

5151
@JsonInclude(JsonInclude.Include.NON_EMPTY)
52-
public record RepoIdentifierSubmissionDTO(long id, Boolean submitted, ZonedDateTime submissionDate, SubmissionType type, Boolean exampleSubmission, Long durationInMinutes,
53-
List<RepoIdentifierResultDTO> results, String commitHash, boolean buildFailed) {
52+
public record RepoNameSubmissionDTO(long id, Boolean submitted, ZonedDateTime submissionDate, SubmissionType type, Boolean exampleSubmission, Long durationInMinutes,
53+
List<RepoNameResultDTO> results, String commitHash, boolean buildFailed) {
5454

5555
/**
5656
* Converts a ProgrammingSubmission into a dto for the endpoint
@@ -59,19 +59,19 @@ public record RepoIdentifierSubmissionDTO(long id, Boolean submitted, ZonedDateT
5959
* @param submission to convert
6060
* @return the converted DTO
6161
*/
62-
public static RepoIdentifierSubmissionDTO of(ProgrammingSubmission submission) {
62+
public static RepoNameSubmissionDTO of(ProgrammingSubmission submission) {
6363
return Optional.ofNullable(submission)
64-
.map(s -> new RepoIdentifierSubmissionDTO(s.getId(), s.isSubmitted(), s.getSubmissionDate(), s.getType(), s.isExampleSubmission(), s.getDurationInMinutes(),
65-
Optional.ofNullable(s.getResults()).orElse(List.of()).stream().filter(Objects::nonNull).map(RepoIdentifierResultDTO::of).toList(), s.getCommitHash(),
64+
.map(s -> new RepoNameSubmissionDTO(s.getId(), s.isSubmitted(), s.getSubmissionDate(), s.getType(), s.isExampleSubmission(), s.getDurationInMinutes(),
65+
Optional.ofNullable(s.getResults()).orElse(List.of()).stream().filter(Objects::nonNull).map(RepoNameResultDTO::of).toList(), s.getCommitHash(),
6666
s.isBuildFailed()))
6767
.orElse(null);
6868
}
6969

7070
}
7171

7272
@JsonInclude(JsonInclude.Include.NON_EMPTY)
73-
public record RepoIdentifierResultDTO(long id, ZonedDateTime completionDate, Boolean successful, Double score, AssessmentType assessmentType, Boolean rated,
74-
Boolean hasComplaint, Boolean exampleResult, Integer testCaseCount, Integer passedTestCaseCount, Integer codeIssueCount, List<RepoIdentifierFeedbackDTO> feedbacks) {
73+
public record RepoNameResultDTO(long id, ZonedDateTime completionDate, Boolean successful, Double score, AssessmentType assessmentType, Boolean rated, Boolean hasComplaint,
74+
Boolean exampleResult, Integer testCaseCount, Integer passedTestCaseCount, Integer codeIssueCount, List<RepoNameFeedbackDTO> feedbacks) {
7575

7676
/**
7777
* Converts a Result into a dto for the endpoint
@@ -80,19 +80,19 @@ public record RepoIdentifierResultDTO(long id, ZonedDateTime completionDate, Boo
8080
* @param result to convert
8181
* @return the converted DTO
8282
*/
83-
public static RepoIdentifierResultDTO of(Result result) {
83+
public static RepoNameResultDTO of(Result result) {
8484
return Optional.ofNullable(result)
85-
.map(r -> new RepoIdentifierResultDTO(r.getId(), r.getCompletionDate(), r.isSuccessful(), r.getScore(), r.getAssessmentType(), r.isRated(), r.hasComplaint(),
85+
.map(r -> new RepoNameResultDTO(r.getId(), r.getCompletionDate(), r.isSuccessful(), r.getScore(), r.getAssessmentType(), r.isRated(), r.hasComplaint(),
8686
r.isExampleResult(), r.getTestCaseCount(), r.getPassedTestCaseCount(), r.getCodeIssueCount(),
87-
Optional.ofNullable(r.getFeedbacks()).orElse(List.of()).stream().filter(Objects::nonNull).map(RepoIdentifierFeedbackDTO::of).toList()))
87+
Optional.ofNullable(r.getFeedbacks()).orElse(List.of()).stream().filter(Objects::nonNull).map(RepoNameFeedbackDTO::of).toList()))
8888
.orElse(null);
8989
}
9090

9191
}
9292

9393
@JsonInclude(JsonInclude.Include.NON_EMPTY)
94-
public record RepoIdentifierFeedbackDTO(long id, String text, String detailText, boolean hasLongFeedbackText, String reference, Double credits, FeedbackType type,
95-
Boolean positive, Long testCaseId) {
94+
public record RepoNameFeedbackDTO(long id, String text, String detailText, boolean hasLongFeedbackText, String reference, Double credits, FeedbackType type, Boolean positive,
95+
Long testCaseId) {
9696

9797
/**
9898
* Converts a Feedback into a dto for the endpoint
@@ -101,18 +101,18 @@ public record RepoIdentifierFeedbackDTO(long id, String text, String detailText,
101101
* @param feedback to convert
102102
* @return the converted DTO
103103
*/
104-
public static RepoIdentifierFeedbackDTO of(Feedback feedback) {
105-
return Optional.ofNullable(feedback).map(f -> new RepoIdentifierFeedbackDTO(f.getId(), f.getText(), f.getDetailText(), f.getHasLongFeedbackText(), f.getReference(),
104+
public static RepoNameFeedbackDTO of(Feedback feedback) {
105+
return Optional.ofNullable(feedback).map(f -> new RepoNameFeedbackDTO(f.getId(), f.getText(), f.getDetailText(), f.getHasLongFeedbackText(), f.getReference(),
106106
f.getCredits(), f.getType(), f.isPositive(), f.getTestCaseId())).orElse(null);
107107
}
108108
}
109109

110110
@JsonInclude(JsonInclude.Include.NON_EMPTY)
111-
public record RepoIdentifierProgrammingExerciseDTO(long id, String problemStatement, String title, String shortName, ZonedDateTime releaseDate, ZonedDateTime startDate,
111+
public record RepoNameProgrammingExerciseDTO(long id, String problemStatement, String title, String shortName, ZonedDateTime releaseDate, ZonedDateTime startDate,
112112
ZonedDateTime dueDate, ZonedDateTime assessmentDueDate, Double maxPoints, Double bonusPoints, AssessmentType assessmentType,
113113
boolean allowComplaintsForAutomaticAssessments, boolean allowFeedbackRequests, DifficultyLevel difficulty, ExerciseMode mode,
114-
IncludedInOverallScore includedInOverallScore, ExerciseType exerciseType, ZonedDateTime exampleSolutionPublicationDate, RepoIdentifierCourseDTO course,
115-
String projectKey, ProgrammingLanguage programmingLanguage, Boolean showTestNamesToStudents, Set<RepoIdentifierTestCaseDTO> testCases) {
114+
IncludedInOverallScore includedInOverallScore, ExerciseType exerciseType, ZonedDateTime exampleSolutionPublicationDate, RepoNameCourseDTO course, String projectKey,
115+
ProgrammingLanguage programmingLanguage, Boolean showTestNamesToStudents, Set<RepoNameTestCaseDTO> testCases) {
116116

117117
/**
118118
* Converts a ProgrammingExercise into a dto for the endpoint
@@ -121,19 +121,19 @@ public record RepoIdentifierProgrammingExerciseDTO(long id, String problemStatem
121121
* @param exercise to convert
122122
* @return the converted DTO
123123
*/
124-
public static RepoIdentifierProgrammingExerciseDTO of(ProgrammingExercise exercise) {
125-
return Optional.ofNullable(exercise).map(e -> new RepoIdentifierProgrammingExerciseDTO(e.getId(), e.getProblemStatement(), e.getTitle(), e.getShortName(),
126-
e.getReleaseDate(), e.getStartDate(), e.getDueDate(), e.getAssessmentDueDate(), e.getMaxPoints(), e.getBonusPoints(), e.getAssessmentType(),
127-
e.getAllowComplaintsForAutomaticAssessments(), e.getAllowFeedbackRequests(), e.getDifficulty(), e.getMode(), e.getIncludedInOverallScore(), e.getExerciseType(),
128-
e.getExampleSolutionPublicationDate(), RepoIdentifierCourseDTO.of(e.getCourseViaExerciseGroupOrCourseMember()), e.getProjectKey(), e.getProgrammingLanguage(),
129-
e.getShowTestNamesToStudents(),
130-
Optional.ofNullable(e.getTestCases()).orElse(Set.of()).stream().filter(Objects::nonNull).map(RepoIdentifierTestCaseDTO::of).collect(Collectors.toSet())))
124+
public static RepoNameProgrammingExerciseDTO of(ProgrammingExercise exercise) {
125+
return Optional.ofNullable(exercise)
126+
.map(e -> new RepoNameProgrammingExerciseDTO(e.getId(), e.getProblemStatement(), e.getTitle(), e.getShortName(), e.getReleaseDate(), e.getStartDate(),
127+
e.getDueDate(), e.getAssessmentDueDate(), e.getMaxPoints(), e.getBonusPoints(), e.getAssessmentType(), e.getAllowComplaintsForAutomaticAssessments(),
128+
e.getAllowFeedbackRequests(), e.getDifficulty(), e.getMode(), e.getIncludedInOverallScore(), e.getExerciseType(), e.getExampleSolutionPublicationDate(),
129+
RepoNameCourseDTO.of(e.getCourseViaExerciseGroupOrCourseMember()), e.getProjectKey(), e.getProgrammingLanguage(), e.getShowTestNamesToStudents(),
130+
Optional.ofNullable(e.getTestCases()).orElse(Set.of()).stream().filter(Objects::nonNull).map(RepoNameTestCaseDTO::of).collect(Collectors.toSet())))
131131
.orElse(null);
132132
}
133133
}
134134

135135
@JsonInclude(JsonInclude.Include.NON_EMPTY)
136-
public record RepoIdentifierCourseDTO(long id, String title, String shortName) {
136+
public record RepoNameCourseDTO(long id, String title, String shortName) {
137137

138138
/**
139139
* Converts a Course into a dto for the endpoint
@@ -142,13 +142,13 @@ public record RepoIdentifierCourseDTO(long id, String title, String shortName) {
142142
* @param course to convert
143143
* @return the converted DTO
144144
*/
145-
public static RepoIdentifierCourseDTO of(Course course) {
146-
return new RepoIdentifierCourseDTO(course.getId(), course.getTitle(), course.getShortName());
145+
public static RepoNameCourseDTO of(Course course) {
146+
return new RepoNameCourseDTO(course.getId(), course.getTitle(), course.getShortName());
147147
}
148148
}
149149

150150
@JsonInclude(JsonInclude.Include.NON_EMPTY)
151-
public record RepoIdentifierTestCaseDTO(long id, String testName, Double weight, double bonusMultiplier, double bonusPoints, Boolean active, Visibility visibility,
151+
public record RepoNameTestCaseDTO(long id, String testName, Double weight, double bonusMultiplier, double bonusPoints, Boolean active, Visibility visibility,
152152
ProgrammingExerciseTestCaseType type) {
153153

154154
/**
@@ -158,8 +158,8 @@ public record RepoIdentifierTestCaseDTO(long id, String testName, Double weight,
158158
* @param testCase to convert
159159
* @return the converted DTO
160160
*/
161-
public static RepoIdentifierTestCaseDTO of(ProgrammingExerciseTestCase testCase) {
162-
return Optional.ofNullable(testCase).map(t -> new RepoIdentifierTestCaseDTO(t.getId(), t.getTestName(), t.getWeight(), t.getBonusMultiplier(), t.getBonusPoints(),
161+
public static RepoNameTestCaseDTO of(ProgrammingExerciseTestCase testCase) {
162+
return Optional.ofNullable(testCase).map(t -> new RepoNameTestCaseDTO(t.getId(), t.getTestName(), t.getWeight(), t.getBonusMultiplier(), t.getBonusPoints(),
163163
t.isActive(), t.getVisibility(), t.getType())).orElse(null);
164164
}
165165
}

src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseParticipationResource.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
import de.tum.cit.aet.artemis.programming.domain.VcsAccessLog;
5757
import de.tum.cit.aet.artemis.programming.domain.VcsRepositoryUri;
5858
import de.tum.cit.aet.artemis.programming.dto.CommitInfoDTO;
59-
import de.tum.cit.aet.artemis.programming.dto.RepoIdentifierProgrammingStudentParticipationDTO;
59+
import de.tum.cit.aet.artemis.programming.dto.RepoNameProgrammingStudentParticipationDTO;
6060
import de.tum.cit.aet.artemis.programming.dto.VcsAccessLogDTO;
6161
import de.tum.cit.aet.artemis.programming.repository.AuxiliaryRepositoryRepository;
6262
import de.tum.cit.aet.artemis.programming.repository.ProgrammingExerciseRepository;
@@ -201,7 +201,7 @@ public ResponseEntity<ProgrammingExerciseStudentParticipation> getParticipationW
201201
@GetMapping("programming-exercise-participations/repo-name/{repoName}")
202202
@EnforceAtLeastStudent
203203
@AllowedTools(ToolTokenType.SCORPIO)
204-
public ResponseEntity<RepoIdentifierProgrammingStudentParticipationDTO> getStudentParticipationWithLatestSubmissionLatestResultFeedbacksByRepoName(
204+
public ResponseEntity<RepoNameProgrammingStudentParticipationDTO> getStudentParticipationWithLatestSubmissionLatestResultFeedbacksByRepoName(
205205
@PathVariable("repoName") String repoName) {
206206

207207
String repoUrl;
@@ -242,7 +242,7 @@ public ResponseEntity<RepoIdentifierProgrammingStudentParticipationDTO> getStude
242242
resultService.filterSensitiveInformationIfNecessary(participation, results, Optional.empty());
243243
}
244244

245-
return ResponseEntity.ok(RepoIdentifierProgrammingStudentParticipationDTO.of(participation));
245+
return ResponseEntity.ok(RepoNameProgrammingStudentParticipationDTO.of(participation));
246246
}
247247

248248
/**

src/test/java/de/tum/cit/aet/artemis/programming/ProgrammingExerciseParticipationIntegrationTest.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import de.tum.cit.aet.artemis.programming.domain.TemplateProgrammingExerciseParticipation;
5252
import de.tum.cit.aet.artemis.programming.domain.VcsRepositoryUri;
5353
import de.tum.cit.aet.artemis.programming.dto.CommitInfoDTO;
54-
import de.tum.cit.aet.artemis.programming.dto.RepoIdentifierProgrammingStudentParticipationDTO;
54+
import de.tum.cit.aet.artemis.programming.dto.RepoNameProgrammingStudentParticipationDTO;
5555

5656
class ProgrammingExerciseParticipationIntegrationTest extends AbstractProgrammingIntegrationIndependentTest {
5757

@@ -666,8 +666,8 @@ void testGetProgrammingExerciseStudentParticipationByRepoName() throws Exception
666666
var participation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, TEST_PREFIX + "student1");
667667

668668
var repoName = extractRepoName(participation.getRepositoryUri());
669-
RepoIdentifierProgrammingStudentParticipationDTO participationDTO = request.get("/api/programming/programming-exercise-participations/repo-name/" + repoName, HttpStatus.OK,
670-
RepoIdentifierProgrammingStudentParticipationDTO.class);
669+
RepoNameProgrammingStudentParticipationDTO participationDTO = request.get("/api/programming/programming-exercise-participations/repo-name/" + repoName, HttpStatus.OK,
670+
RepoNameProgrammingStudentParticipationDTO.class);
671671

672672
assertThat(participationDTO.id()).isEqualTo(participation.getId());
673673
assertThat(participationDTO.exercise().id()).isEqualTo(participation.getExercise().getId());
@@ -692,18 +692,18 @@ void testGetProgrammingExerciseStudentParticipationByRepoNameWithSubmissionAndRe
692692
latestResult = participationUtilService.addFeedbackToResult(new Feedback().testCase(testCases[0]), latestResult);
693693

694694
var repoName = extractRepoName(participation.getRepositoryUri());
695-
RepoIdentifierProgrammingStudentParticipationDTO participationDTO = request.get("/api/programming/programming-exercise-participations/repo-name/" + repoName, HttpStatus.OK,
696-
RepoIdentifierProgrammingStudentParticipationDTO.class);
695+
RepoNameProgrammingStudentParticipationDTO participationDTO = request.get("/api/programming/programming-exercise-participations/repo-name/" + repoName, HttpStatus.OK,
696+
RepoNameProgrammingStudentParticipationDTO.class);
697697

698698
assertThat(participationDTO.id()).isEqualTo(participation.getId());
699699
assertThat(participationDTO.exercise().id()).isEqualTo(participation.getExercise().getId());
700700
assertThat(participationDTO.exercise().course().id()).isEqualTo(participation.getExercise().getCourseViaExerciseGroupOrCourseMember().getId());
701701

702702
assertThat(participationDTO.submissions()).hasSize(1);
703-
var submissionDTO = participationDTO.submissions().toArray(RepoIdentifierProgrammingStudentParticipationDTO.RepoIdentifierSubmissionDTO[]::new)[0];
703+
var submissionDTO = participationDTO.submissions().toArray(RepoNameProgrammingStudentParticipationDTO.RepoNameSubmissionDTO[]::new)[0];
704704
assertThat(submissionDTO.id()).isEqualTo(latestResult.getSubmission().getId());
705705
assertThat(submissionDTO.results()).hasSize(1);
706-
var resultDTO = submissionDTO.results().toArray(RepoIdentifierProgrammingStudentParticipationDTO.RepoIdentifierResultDTO[]::new)[0];
706+
var resultDTO = submissionDTO.results().toArray(RepoNameProgrammingStudentParticipationDTO.RepoNameResultDTO[]::new)[0];
707707
assertThat(resultDTO.id()).isEqualTo(latestResult.getId());
708708
assertThat(resultDTO.feedbacks()).isNotEmpty();
709709
for (var feedbackDTO : resultDTO.feedbacks()) {

0 commit comments

Comments
 (0)