diff --git a/src/main/java/de/tum/in/www1/artemis/domain/Course.java b/src/main/java/de/tum/in/www1/artemis/domain/Course.java index f67803ed8073..952dd81e6af6 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/Course.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/Course.java @@ -131,6 +131,9 @@ public class Course extends DomainObject { @JsonView(QuizView.Before.class) private CourseInformationSharingConfiguration courseInformationSharingConfiguration = CourseInformationSharingConfiguration.COMMUNICATION_AND_MESSAGING; // default value + @Column(name = "info_sharing_messaging_code_of_conduct") + private String courseInformationSharingMessagingCodeOfConduct; + @Column(name = "max_complaints", nullable = false) @JsonView(QuizView.Before.class) private Integer maxComplaints = 3; // default value @@ -1005,4 +1008,11 @@ public void setCourseInformationSharingConfiguration(CourseInformationSharingCon this.courseInformationSharingConfiguration = courseInformationSharingConfiguration; } + public String getCourseInformationSharingMessagingCodeOfConduct() { + return this.courseInformationSharingMessagingCodeOfConduct; + } + + public void setCourseInformationSharingMessagingCodeOfConduct(String courseInformationSharingMessagingCodeOfConduct) { + this.courseInformationSharingMessagingCodeOfConduct = courseInformationSharingMessagingCodeOfConduct; + } } diff --git a/src/main/java/de/tum/in/www1/artemis/domain/Exercise.java b/src/main/java/de/tum/in/www1/artemis/domain/Exercise.java index f4bd0ce6fe18..60441190ccb5 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/Exercise.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/Exercise.java @@ -499,7 +499,7 @@ public Submission findLatestSubmissionWithRatedResultWithCompletionDate(Particip boolean isAssessmentOver = ignoreAssessmentDueDate || ExerciseDateService.isAfterAssessmentDueDate(this); boolean isProgrammingExercise = participation.getExercise() instanceof ProgrammingExercise; // Check that submission was submitted in time (rated). For non programming exercises we check if the assessment due date has passed (if set) - boolean ratedOrPractice = Boolean.TRUE.equals(result.isRated()) || participation.isTestRun(); + boolean ratedOrPractice = Boolean.TRUE.equals(result.isRated()) || participation.isPracticeMode(); boolean noProgrammingAndAssessmentOver = !isProgrammingExercise && isAssessmentOver; // For programming exercises we check that the assessment due date has passed (if set) for manual results otherwise we always show the automatic result boolean programmingAfterAssessmentOrAutomatic = isProgrammingExercise && ((result.isManual() && isAssessmentOver) || result.isAutomatic()); diff --git a/src/main/java/de/tum/in/www1/artemis/domain/ProgrammingExercise.java b/src/main/java/de/tum/in/www1/artemis/domain/ProgrammingExercise.java index 5f79a608e1e7..74c5da833ffe 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/ProgrammingExercise.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/ProgrammingExercise.java @@ -673,8 +673,8 @@ public Set findResultsFilteredForStudents(Participation participation) { public List findRelevantParticipation(List participations) { List participationOfExercise = participations.stream() .filter(participation -> participation.getExercise() != null && participation.getExercise().equals(this)).toList(); - List gradedParticipations = participationOfExercise.stream().filter(participation -> !participation.isTestRun()).toList(); - List practiceParticipations = participationOfExercise.stream().filter(Participation::isTestRun).toList(); + List gradedParticipations = participationOfExercise.stream().filter(participation -> !participation.isPracticeMode()).toList(); + List practiceParticipations = participationOfExercise.stream().filter(Participation::isPracticeMode).toList(); if (gradedParticipations.size() > 1) { gradedParticipations = super.findRelevantParticipation(gradedParticipations); diff --git a/src/main/java/de/tum/in/www1/artemis/domain/Result.java b/src/main/java/de/tum/in/www1/artemis/domain/Result.java index aeed3aa7bebc..a19e5f2f84b2 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/Result.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/Result.java @@ -236,7 +236,7 @@ public void setRatedIfNotAfterDueDate() { if (submission.getType() == SubmissionType.INSTRUCTOR || submission.getType() == SubmissionType.TEST) { this.rated = true; } - else if (submission.getType() == SubmissionType.ILLEGAL || participation.isTestRun()) { + else if (submission.getType() == SubmissionType.ILLEGAL || participation.isPracticeMode()) { this.rated = false; } else { diff --git a/src/main/java/de/tum/in/www1/artemis/domain/participation/Participation.java b/src/main/java/de/tum/in/www1/artemis/domain/participation/Participation.java index 21290f5d510a..7a6e8bfda395 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/participation/Participation.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/participation/Participation.java @@ -144,6 +144,25 @@ public void setTestRun(boolean testRun) { this.testRun = testRun; } + /** + * Same as {@link #isTestRun} since {@link Participation#testRun} is used to determine if a participation in a course exercise is used for practice purposes + * + * @return true if the participation is only used for practicing after the due date + */ + @JsonIgnore + public boolean isPracticeMode() { + return Boolean.TRUE.equals(testRun); + } + + /** + * Same as {@link #setTestRun} since {@link Participation#testRun} is used to determine if a participation in a course exercise is used for practice purposes + * + * @param practiceMode sets the testRun flag to this value + */ + public void setPracticeMode(boolean practiceMode) { + this.testRun = practiceMode; + } + public Set getResults() { return results; } @@ -282,7 +301,7 @@ private Optional findLatestSubmission(boolean includeI * @return the same string with "practice-" added to the front if this is a test run participation */ public String addPracticePrefixIfTestRun(String string) { - return (isTestRun() ? "practice-" : "") + string; + return (isPracticeMode() ? "practice-" : "") + string; } @Override diff --git a/src/main/java/de/tum/in/www1/artemis/service/CourseScoreCalculationService.java b/src/main/java/de/tum/in/www1/artemis/service/CourseScoreCalculationService.java index c9544259c25f..a7e8c64e6c3b 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/CourseScoreCalculationService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/CourseScoreCalculationService.java @@ -201,7 +201,7 @@ public CourseForDashboardDTO getScoresAndParticipationResults(Course course, Gra // TODO: Look into refactoring the fetchParticipationsWithSubmissionsAndResultsForCourses method in the CourseService to always initialize the participations (to an // empty list if there aren't any). This way you don't need this very unintuitive check for the initialization state. if (Hibernate.isInitialized(exercise.getStudentParticipations())) { - exercise.getStudentParticipations().stream().filter(participation -> !participation.isTestRun()).forEach(participation -> { + exercise.getStudentParticipations().stream().filter(participation -> !participation.isPracticeMode()).forEach(participation -> { participation.setExercise(exercise); gradedStudentParticipations.add(participation); }); diff --git a/src/main/java/de/tum/in/www1/artemis/service/ParticipationService.java b/src/main/java/de/tum/in/www1/artemis/service/ParticipationService.java index da50d02f8fa6..951d97edf8b1 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/ParticipationService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/ParticipationService.java @@ -118,7 +118,7 @@ public StudentParticipation startExercise(Exercise exercise, Participant partici public StudentParticipation startExerciseWithInitializationDate(Exercise exercise, Participant participant, boolean createInitialSubmission, ZonedDateTime initializationDate) { // common for all exercises Optional optionalStudentParticipation = findOneByExerciseAndParticipantAnyState(exercise, participant); - if (optionalStudentParticipation.isPresent() && optionalStudentParticipation.get().isTestRun() && exercise.isCourseExercise()) { + if (optionalStudentParticipation.isPresent() && optionalStudentParticipation.get().isPracticeMode() && exercise.isCourseExercise()) { // In case there is already a practice participation, set it to inactive optionalStudentParticipation.get().setInitializationState(InitializationState.INACTIVE); studentParticipationRepository.saveAndFlush(optionalStudentParticipation.get()); @@ -285,7 +285,7 @@ public StudentParticipation startPracticeMode(Exercise exercise, Participant par participation.setInitializationState(InitializationState.UNINITIALIZED); participation.setExercise(exercise); participation.setParticipant(participant); - participation.setTestRun(true); + participation.setPracticeMode(true); participation = studentParticipationRepository.saveAndFlush(participation); } else { @@ -394,7 +394,7 @@ public ProgrammingExerciseStudentParticipation resumeProgrammingExercise(Program // If a graded participation gets reset after the due date set the state back to finished. Otherwise, the participation is initialized var dueDate = ExerciseDateService.getDueDate(participation); - if (!participation.isTestRun() && dueDate.isPresent() && ZonedDateTime.now().isAfter(dueDate.get())) { + if (!participation.isPracticeMode() && dueDate.isPresent() && ZonedDateTime.now().isAfter(dueDate.get())) { participation.setInitializationState(InitializationState.FINISHED); } else { @@ -646,7 +646,7 @@ public void cleanupBuildPlan(ProgrammingExerciseStudentParticipation participati // If a graded participation gets cleaned up after the due date set the state back to finished. Otherwise, the participation is initialized var dueDate = ExerciseDateService.getDueDate(participation); - if (!participation.isTestRun() && dueDate.isPresent() && ZonedDateTime.now().isAfter(dueDate.get())) { + if (!participation.isPracticeMode() && dueDate.isPresent() && ZonedDateTime.now().isAfter(dueDate.get())) { participation.setInitializationState(InitializationState.FINISHED); } else { diff --git a/src/main/java/de/tum/in/www1/artemis/service/plagiarism/ProgrammingPlagiarismDetectionService.java b/src/main/java/de/tum/in/www1/artemis/service/plagiarism/ProgrammingPlagiarismDetectionService.java index 6ecdb4db702e..42303cc9b6c6 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/plagiarism/ProgrammingPlagiarismDetectionService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/plagiarism/ProgrammingPlagiarismDetectionService.java @@ -330,7 +330,7 @@ private Language getJPlagProgrammingLanguage(ProgrammingExercise programmingExer public List filterStudentParticipationsForComparison(ProgrammingExercise programmingExercise, int minimumScore) { var studentParticipations = studentParticipationRepository.findAllForPlagiarism(programmingExercise.getId()); - return studentParticipations.parallelStream().filter(participation -> !participation.isTestRun()) + return studentParticipations.parallelStream().filter(participation -> !participation.isPracticeMode()) .filter(participation -> participation instanceof ProgrammingExerciseParticipation).map(participation -> (ProgrammingExerciseParticipation) participation) .filter(participation -> participation.getVcsRepositoryUrl() != null).filter(participation -> { Submission submission = participation.findLatestSubmission().orElse(null); diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseExportService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseExportService.java index de1a21404714..6cdadd39c01d 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseExportService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseExportService.java @@ -707,7 +707,7 @@ private Path createZipForRepositoryWithParticipation(final ProgrammingExercise p return null; } - if (repositoryExportOptions.isExcludePracticeSubmissions() && participation.isTestRun()) { + if (repositoryExportOptions.isExcludePracticeSubmissions() && participation.isPracticeMode()) { log.debug("Ignoring practice participation {}", participation); return null; } diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseGradingService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseGradingService.java index b5433797faa6..e53acc5495bc 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseGradingService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseGradingService.java @@ -272,11 +272,11 @@ private Result processNewProgrammingExerciseResult(final ProgrammingExercisePart // test run repository). // Student test exam participations will still be locked by this. SubmissionPolicy submissionPolicy = programmingExerciseRepository.findWithSubmissionPolicyById(programmingExercise.getId()).orElseThrow().getSubmissionPolicy(); - if (submissionPolicy instanceof LockRepositoryPolicy policy && !((ProgrammingExerciseStudentParticipation) participation).isTestRun()) { + if (submissionPolicy instanceof LockRepositoryPolicy policy && !((ProgrammingExerciseStudentParticipation) participation).isPracticeMode()) { submissionPolicyService.handleLockRepositoryPolicy(processedResult, (Participation) participation, policy); } - if (programmingSubmission.getLatestResult() != null && programmingSubmission.getLatestResult().isManual() && !((Participation) participation).isTestRun()) { + if (programmingSubmission.getLatestResult() != null && programmingSubmission.getLatestResult().isManual() && !((Participation) participation).isPracticeMode()) { // Note: in this case, we do not want to save the processedResult, but we only want to update the latest semi-automatic one Result updatedLatestSemiAutomaticResult = updateLatestSemiAutomaticResultWithNewAutomaticFeedback(programmingSubmission.getLatestResult().getId(), processedResult); // Adding back dropped submission diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingSubmissionService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingSubmissionService.java index 388821a2274f..f90950428499 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingSubmissionService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingSubmissionService.java @@ -272,7 +272,8 @@ private boolean isAllowedToSubmit(ProgrammingExerciseStudentParticipation partic private boolean isAllowedToSubmitForCourseExercise(ProgrammingExerciseStudentParticipation participation, ProgrammingSubmission programmingSubmission) { var dueDate = ExerciseDateService.getDueDate(participation); - if (dueDate.isEmpty() || participation.isTestRun()) { + // Without a due date or in the practice mode, the student can always submit + if (dueDate.isEmpty() || participation.isPracticeMode()) { return true; } return dueDate.get().plusSeconds(PROGRAMMING_GRACE_PERIOD_SECONDS).isAfter(programmingSubmission.getSubmissionDate()); diff --git a/src/main/java/de/tum/in/www1/artemis/web/rest/ParticipationResource.java b/src/main/java/de/tum/in/www1/artemis/web/rest/ParticipationResource.java index 97dc320c2573..f5ce2422a5dc 100644 --- a/src/main/java/de/tum/in/www1/artemis/web/rest/ParticipationResource.java +++ b/src/main/java/de/tum/in/www1/artemis/web/rest/ParticipationResource.java @@ -290,7 +290,7 @@ public ResponseEntity resumeParticipati // There is a second participation of that student in the exericse that is inactive/finished now Optional optionalOtherStudentParticipation = participationService.findOneByExerciseAndParticipantAnyStateAndTestRun(programmingExercise, user, - !participation.isTestRun()); + !participation.isPracticeMode()); if (optionalOtherStudentParticipation.isPresent()) { StudentParticipation otherParticipation = optionalOtherStudentParticipation.get(); if (participation.getInitializationState() == InitializationState.INACTIVE) { @@ -371,7 +371,7 @@ public ResponseEntity requestFeedback(@ private boolean isAllowedToParticipateInProgrammingExercise(ProgrammingExercise programmingExercise, @Nullable StudentParticipation participation) { if (participation != null) { // only regular participation before the due date; only practice run afterwards - return participation.isTestRun() == exerciseDateService.isAfterDueDate(participation); + return participation.isPracticeMode() == exerciseDateService.isAfterDueDate(participation); } else { return programmingExercise.getDueDate() == null || now().isBefore(programmingExercise.getDueDate()); @@ -424,7 +424,7 @@ public ResponseEntity updateParticipation(@PathVariable long exer Optional gradingScale = gradingScaleService.findGradingScaleByCourseId(participation.getExercise().getCourseViaExerciseGroupOrCourseMember().getId()); // Presentation Score is only valid for non practice participations - if (participation.isTestRun()) { + if (participation.isPracticeMode()) { throw new BadRequestAlertException("Presentation score is not allowed for practice participations", ENTITY_NAME, "presentationScoreInvalid"); } diff --git a/src/main/resources/config/liquibase/changelog/20230907225501_changelog.xml b/src/main/resources/config/liquibase/changelog/20230907225501_changelog.xml new file mode 100644 index 000000000000..6ce1a1de6303 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20230907225501_changelog.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index eb868ed1b3bf..103a5319cfba 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -53,6 +53,7 @@ + diff --git a/src/main/webapp/app/course/manage/course-update.component.html b/src/main/webapp/app/course/manage/course-update.component.html index 180893a4d23b..b943661e4fa1 100644 --- a/src/main/webapp/app/course/manage/course-update.component.html +++ b/src/main/webapp/app/course/manage/course-update.component.html @@ -336,6 +336,18 @@
ngbTooltip="{{ 'artemisApp.course.courseCommunicationSetting.messagingEnabled.tooltip' | artemisTranslate }}" > +
+ + + + +
diff --git a/src/main/webapp/app/course/manage/course-update.component.ts b/src/main/webapp/app/course/manage/course-update.component.ts index beb9d3162bb1..315fe2e8c2d1 100644 --- a/src/main/webapp/app/course/manage/course-update.component.ts +++ b/src/main/webapp/app/course/manage/course-update.component.ts @@ -156,6 +156,7 @@ export class CourseUpdateComponent implements OnInit { editorGroupName: new FormControl(this.course.editorGroupName), instructorGroupName: new FormControl(this.course.instructorGroupName), description: new FormControl(this.course.description), + courseInformationSharingMessagingCodeOfConduct: new FormControl(this.course.courseInformationSharingMessagingCodeOfConduct), organizations: new FormControl(this.courseOrganizations), startDate: new FormControl(this.course.startDate), endDate: new FormControl(this.course.endDate), @@ -520,6 +521,14 @@ export class CourseUpdateComponent implements OnInit { this.courseForm.controls['registrationConfirmationMessage'].setValue(message); } + /** + * Updates courseInformationSharingMessagingCodeOfConduct on markdown change + * @param message new courseInformationSharingMessagingCodeOfConduct + */ + updateCourseInformationSharingMessagingCodeOfConduct(message: string) { + this.courseForm.controls['courseInformationSharingMessagingCodeOfConduct'].setValue(message); + } + /** * Auxiliary method checking if online course is currently true */ diff --git a/src/main/webapp/app/entities/course.model.ts b/src/main/webapp/app/entities/course.model.ts index aae8b0627951..c155170c05e5 100644 --- a/src/main/webapp/app/entities/course.model.ts +++ b/src/main/webapp/app/entities/course.model.ts @@ -97,6 +97,7 @@ export class Course implements BaseEntity { public tutorialGroups?: TutorialGroup[]; public onlineCourseConfiguration?: OnlineCourseConfiguration; public courseInformationSharingConfiguration?: CourseInformationSharingConfiguration; + public courseInformationSharingMessagingCodeOfConduct?: string; // helper attributes public isAtLeastTutor?: boolean; diff --git a/src/main/webapp/app/entities/participation/student-participation.model.ts b/src/main/webapp/app/entities/participation/student-participation.model.ts index 19fadd0e3a7d..b5920eb29974 100644 --- a/src/main/webapp/app/entities/participation/student-participation.model.ts +++ b/src/main/webapp/app/entities/participation/student-participation.model.ts @@ -11,3 +11,22 @@ export class StudentParticipation extends Participation { super(type ?? ParticipationType.STUDENT); } } + +/** + * Checks if the participation is used for practicing in a course exercise. This is the case if testRun is set to true + * @param studentParticipation the participation to check + */ +export function isPracticeMode(studentParticipation: StudentParticipation | undefined): boolean | undefined { + return studentParticipation?.testRun; +} + +/** + * Stores whether the participation is used for practicing in a course exercise. + * @param studentParticipation the participation that should store if it is used for practicing + * @param practiceMode true, if it is used for practicing + */ +export function setPracticeMode(studentParticipation: StudentParticipation | undefined, practiceMode: boolean) { + if (studentParticipation) { + studentParticipation.testRun = practiceMode; + } +} diff --git a/src/main/webapp/app/exercises/programming/shared/utils/programming-exercise.utils.ts b/src/main/webapp/app/exercises/programming/shared/utils/programming-exercise.utils.ts index 832436e2cc14..1727ac8232d5 100644 --- a/src/main/webapp/app/exercises/programming/shared/utils/programming-exercise.utils.ts +++ b/src/main/webapp/app/exercises/programming/shared/utils/programming-exercise.utils.ts @@ -10,6 +10,7 @@ import { ProgrammingSubmission } from 'app/entities/programming-submission.model import { SubmissionType } from 'app/entities/submission.model'; import { ProgrammingExerciseStudentParticipation } from 'app/entities/participation/programming-exercise-student-participation.model'; import { AssessmentType } from 'app/entities/assessment-type.model'; +import { isPracticeMode } from 'app/entities/participation/student-participation.model'; const BAMBOO_RESULT_LEGACY_TIMESTAMP = 1557526348000; @@ -42,7 +43,7 @@ export const createCommitUrl = ( const studentParticipation = participation as ProgrammingExerciseStudentParticipation; if (studentParticipation.repositoryUrl) { repoSlugPostfix = studentParticipation.participantIdentifier; - if (studentParticipation.testRun) { + if (isPracticeMode(studentParticipation)) { repoSlugPostfix = 'practice-' + repoSlugPostfix; } } @@ -75,7 +76,7 @@ export const isResultPreliminary = (latestResult: Result, programmingExercise?: if (!programmingExercise) { return false; } - if (latestResult.participation?.type === ParticipationType.PROGRAMMING && (latestResult.participation as ProgrammingExerciseStudentParticipation).testRun) { + if (latestResult.participation?.type === ParticipationType.PROGRAMMING && isPracticeMode(latestResult.participation)) { return false; } diff --git a/src/main/webapp/app/exercises/shared/exercise/exercise.utils.ts b/src/main/webapp/app/exercises/shared/exercise/exercise.utils.ts index 0d7c9e66e9ea..2c738133e8dd 100644 --- a/src/main/webapp/app/exercises/shared/exercise/exercise.utils.ts +++ b/src/main/webapp/app/exercises/shared/exercise/exercise.utils.ts @@ -12,7 +12,7 @@ import { ExerciseServicable } from 'app/exercises/shared/exercise/exercise.servi import { map, mergeMap, mergeWith, takeUntil } from 'rxjs/operators'; import { ExerciseUpdateWarningComponent } from 'app/exercises/shared/exercise-update-warning/exercise-update-warning.component'; import { AlertService, AlertType } from 'app/core/util/alert.service'; -import { StudentParticipation } from 'app/entities/participation/student-participation.model'; +import { StudentParticipation, isPracticeMode } from 'app/entities/participation/student-participation.model'; export enum EditType { IMPORT, @@ -154,7 +154,7 @@ export const isStartExerciseAvailable = (exercise: Exercise, participation?: Stu export const isResumeExerciseAvailable = (exercise: Exercise, participation?: StudentParticipation): boolean => { const dueDate = participation?.individualDueDate ?? exercise.dueDate; // A normal participation may only be resumed before the due date, a testrun only afterwards - return (!dueDate || dayjs().isBefore(dueDate)) === !participation?.testRun; + return (!dueDate || dayjs().isBefore(dueDate)) === !isPracticeMode(participation); }; /** diff --git a/src/main/webapp/app/exercises/shared/participation/participation.component.ts b/src/main/webapp/app/exercises/shared/participation/participation.component.ts index 93b58480cf87..80aa5e17acb3 100644 --- a/src/main/webapp/app/exercises/shared/participation/participation.component.ts +++ b/src/main/webapp/app/exercises/shared/participation/participation.component.ts @@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { Subject, Subscription } from 'rxjs'; import { ParticipationService } from './participation.service'; import { ActivatedRoute } from '@angular/router'; -import { StudentParticipation } from 'app/entities/participation/student-participation.model'; +import { StudentParticipation, isPracticeMode } from 'app/entities/participation/student-participation.model'; import { ExerciseSubmissionState, ProgrammingSubmissionService, ProgrammingSubmissionState } from 'app/exercises/programming/participate/programming-submission.service'; import { ActionType } from 'app/shared/delete-dialog/delete-dialog.model'; import { HttpErrorResponse } from '@angular/common/http'; @@ -191,7 +191,7 @@ export class ParticipationComponent implements OnInit, OnDestroy { case FilterProp.NO_SUBMISSIONS: return participation.submissionCount === 0; case FilterProp.NO_PRACTICE: - return !participation.testRun; + return !isPracticeMode(participation); case FilterProp.ALL: default: return true; diff --git a/src/main/webapp/app/exercises/shared/result/result.component.ts b/src/main/webapp/app/exercises/shared/result/result.component.ts index abd7297b8095..66434bc1963c 100644 --- a/src/main/webapp/app/exercises/shared/result/result.component.ts +++ b/src/main/webapp/app/exercises/shared/result/result.component.ts @@ -22,9 +22,9 @@ import { hasExerciseDueDatePassed } from 'app/exercises/shared/exercise/exercise import { faCircleNotch, faExclamationCircle, faExclamationTriangle, faFile } from '@fortawesome/free-solid-svg-icons'; import { faCircle } from '@fortawesome/free-regular-svg-icons'; import { Badge, ResultService } from 'app/exercises/shared/result/result.service'; -import { ProgrammingExerciseStudentParticipation } from 'app/entities/participation/programming-exercise-student-participation.model'; import { ExerciseCacheService } from 'app/exercises/shared/exercise/exercise-cache.service'; import { ExerciseService } from 'app/exercises/shared/exercise/exercise.service'; +import { isPracticeMode } from 'app/entities/participation/student-participation.model'; @Component({ selector: 'jhi-result', @@ -191,7 +191,7 @@ export class ResultComponent implements OnInit, OnChanges { if ( this.participation && isProgrammingExerciseStudentParticipation(this.participation) && - !(this.participation as ProgrammingExerciseStudentParticipation).testRun && + !isPracticeMode(this.participation) && isResultPreliminary(this.result!, programmingExercise) ) { if (programmingExercise?.assessmentType !== AssessmentType.AUTOMATIC) { diff --git a/src/main/webapp/app/exercises/shared/result/result.service.ts b/src/main/webapp/app/exercises/shared/result/result.service.ts index 94d9ecb47d6b..429ccc9ab4ad 100644 --- a/src/main/webapp/app/exercises/shared/result/result.service.ts +++ b/src/main/webapp/app/exercises/shared/result/result.service.ts @@ -6,7 +6,7 @@ import { Result } from 'app/entities/result.model'; import { ResultWithPointsPerGradingCriterion } from 'app/entities/result-with-points-per-grading-criterion.model'; import { createRequestOption } from 'app/shared/util/request.util'; import { Feedback } from 'app/entities/feedback.model'; -import { StudentParticipation } from 'app/entities/participation/student-participation.model'; +import { StudentParticipation, isPracticeMode } from 'app/entities/participation/student-participation.model'; import { Exercise, ExerciseType, getCourseFromExercise } from 'app/entities/exercise.model'; import { map, tap } from 'rxjs/operators'; import { ParticipationService } from 'app/exercises/shared/participation/participation.service'; @@ -131,7 +131,7 @@ export class ResultService implements IResultService { }); } - let resultString = this.getBaseResultStringProgrammingExercise(result, exercise, relativeScore, points, buildAndTestMessage, short); + let resultString = this.getBaseResultStringProgrammingExercise(result, relativeScore, points, buildAndTestMessage, short); if (isResultPreliminary(result, exercise)) { resultString += ' (' + this.translateService.instant('artemisApp.result.preliminary') + ')'; @@ -143,20 +143,12 @@ export class ResultService implements IResultService { /** * Generates the result string for a programming exercise * @param result the result containing all necessary information like the achieved points - * @param exercise the exercise where the result belongs to * @param relativeScore the achieved score in percent * @param points the amount of achieved points * @param buildAndTestMessage the string containing information about the build. Either about the build failure or the passed tests * @param short flag that indicates if the resultString should use the short format */ - private getBaseResultStringProgrammingExercise( - result: Result, - exercise: ProgrammingExercise, - relativeScore: number, - points: number, - buildAndTestMessage: string, - short: boolean | undefined, - ): string { + private getBaseResultStringProgrammingExercise(result: Result, relativeScore: number, points: number, buildAndTestMessage: string, short: boolean | undefined): string { if (short) { if (!result.testCaseCount) { return this.translateService.instant('artemisApp.result.resultString.programmingShort', { @@ -302,8 +294,7 @@ export class ResultService implements IResultService { public static evaluateBadge(participation: Participation, result: Result): Badge { if (participation.type === ParticipationType.STUDENT || participation.type === ParticipationType.PROGRAMMING) { - const studentParticipation = participation as StudentParticipation; - if (studentParticipation.testRun) { + if (isPracticeMode(participation)) { return { class: 'bg-secondary', text: 'artemisApp.result.practice', tooltip: 'artemisApp.result.practiceTooltip' }; } } diff --git a/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.html b/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.html index f0ef2d40f634..c47dba02c5f5 100644 --- a/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.html +++ b/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.html @@ -16,7 +16,7 @@
- + diff --git a/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.ts b/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.ts index 065e5e3801c0..fe9f00995b97 100644 --- a/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.ts +++ b/src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.ts @@ -11,6 +11,7 @@ import { ProgrammingExerciseStudentParticipation } from 'app/entities/participat import { ParticipationService } from 'app/exercises/shared/participation/participation.service'; import { Exercise } from 'app/entities/exercise.model'; import { PROFILE_LOCALVC } from 'app/app.constants'; +import { isPracticeMode } from 'app/entities/participation/student-participation.model'; @Component({ selector: 'jhi-clone-repo-button', @@ -44,6 +45,7 @@ export class CloneRepoButtonComponent implements OnInit, OnChanges { wasCopied = false; isTeamParticipation: boolean; activeParticipation?: ProgrammingExerciseStudentParticipation; + isPracticeMode: boolean | undefined; // Icons faDownload = faDownload; @@ -88,10 +90,9 @@ export class CloneRepoButtonComponent implements OnInit, OnChanges { if (this.participations?.length) { const shouldPreferPractice = this.participationService.shouldPreferPractice(this.exercise); this.activeParticipation = this.participationService.getSpecificStudentParticipation(this.participations, shouldPreferPractice) ?? this.participations[0]; + this.isPracticeMode = isPracticeMode(this.activeParticipation); this.cloneHeadline = - this.activeParticipation.testRun && !this.exercise?.exerciseGroup - ? 'artemisApp.exerciseActions.clonePracticeRepository' - : 'artemisApp.exerciseActions.cloneRatedRepository'; + this.isPracticeMode && !this.exercise?.exerciseGroup ? 'artemisApp.exerciseActions.clonePracticeRepository' : 'artemisApp.exerciseActions.cloneRatedRepository'; this.isTeamParticipation = !!this.activeParticipation?.team; } else if (this.repositoryUrl) { this.cloneHeadline = 'artemisApp.exerciseActions.cloneExerciseRepository'; @@ -193,7 +194,8 @@ export class CloneRepoButtonComponent implements OnInit, OnChanges { } switchPracticeMode() { - this.activeParticipation = this.participationService.getSpecificStudentParticipation(this.participations!, !this.activeParticipation?.testRun)!; - this.cloneHeadline = this.activeParticipation.testRun ? 'artemisApp.exerciseActions.clonePracticeRepository' : 'artemisApp.exerciseActions.cloneRatedRepository'; + this.isPracticeMode = !this.isPracticeMode; + this.activeParticipation = this.participationService.getSpecificStudentParticipation(this.participations!, this.isPracticeMode)!; + this.cloneHeadline = this.isPracticeMode ? 'artemisApp.exerciseActions.clonePracticeRepository' : 'artemisApp.exerciseActions.cloneRatedRepository'; } } diff --git a/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.html b/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.html index e12535678d1d..dcf525d4361d 100644 --- a/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.html +++ b/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.html @@ -29,7 +29,7 @@ >
- + @@ -40,7 +40,7 @@ [buttonIcon]="faFolderOpen" class="open-code-editor" [jhiFeatureToggle]="FeatureToggle.ProgrammingExercises" - [buttonLabel]="'artemisApp.exerciseActions.' + (activeParticipation.testRun ? 'openPracticeCodeEditor' : 'openGradedCodeEditor') | artemisTranslate" + [buttonLabel]="'artemisApp.exerciseActions.' + (isPracticeMode ? 'openPracticeCodeEditor' : 'openGradedCodeEditor') | artemisTranslate" [buttonLoading]="loading" [smallButton]="smallButtons" [hideLabelMobile]="false" diff --git a/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.ts b/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.ts index 039ae8ddf45b..4871d89ba095 100644 --- a/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.ts +++ b/src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.ts @@ -25,6 +25,7 @@ export class OpenCodeEditorButtonComponent implements OnChanges { courseAndExerciseNavigationUrl: string; activeParticipation: ProgrammingExerciseStudentParticipation; + isPracticeMode: boolean | undefined; // Icons faFolderOpen = faFolderOpen; @@ -38,6 +39,7 @@ export class OpenCodeEditorButtonComponent implements OnChanges { } switchPracticeMode() { - this.activeParticipation = this.participationService.getSpecificStudentParticipation(this.participations!, !this.activeParticipation.testRun)!; + this.isPracticeMode = !this.isPracticeMode; + this.activeParticipation = this.participationService.getSpecificStudentParticipation(this.participations!, this.isPracticeMode)!; } } diff --git a/src/main/webapp/i18n/de/course.json b/src/main/webapp/i18n/de/course.json index 642561a24be8..3390637f6d32 100644 --- a/src/main/webapp/i18n/de/course.json +++ b/src/main/webapp/i18n/de/course.json @@ -93,7 +93,11 @@ }, "messagingEnabled": { "label": "Nachrichten aktiviert", - "tooltip": "Ermöglicht den Nachrichtenaustausch zwischen Nutzer:innen in privaten oder öffentlichen Kanälen, Gruppenchats oder Direktnachrichten. Kanäle können nur von Lehrenden und Tutor:innen erstellt werden. Nutzer:innen können selbst öffentlichen Kanälen beitreten und müssen zu privaten Kanälen hinzugefügt werden. Alle Nutzer:innen können einen privaten Gruppenchat starten und andere Nutzer:innen hinzufügen. Ein Gruppenchat ist auf zehn Mitglieder:innen begrenzt. Alle Nutzer:innen können Direktnachrichten an andere Nutzer:innen senden. Die Chats finden im Nachrichtenbereich des Kurses statt." + "tooltip": "Ermöglicht den Nachrichtenaustausch zwischen Nutzer:innen in privaten oder öffentlichen Kanälen, Gruppenchats oder Direktnachrichten. Kanäle können nur von Lehrenden und Tutor:innen erstellt werden. Nutzer:innen können selbst öffentlichen Kanälen beitreten und müssen zu privaten Kanälen hinzugefügt werden. Alle Nutzer:innen können einen privaten Gruppenchat starten und andere Nutzer:innen hinzufügen. Ein Gruppenchat ist auf zehn Mitglieder:innen begrenzt. Alle Nutzer:innen können Direktnachrichten an andere Nutzer:innen senden. Die Chats finden im Nachrichtenbereich des Kurses statt.", + "codeOfConduct": { + "label": "Verhaltenskodex", + "tooltip": "Der Verhaltenskodex gibt Nutzer:innen an, wie sie miteinander kommunizieren sollen und welche Konsequenzen bei Fehlverhalten drohen können, sowie einen Kontakt zur Berichterstattung." + } } }, "registrationEnabled": { diff --git a/src/main/webapp/i18n/en/course.json b/src/main/webapp/i18n/en/course.json index 978785393729..6e8695f31d42 100644 --- a/src/main/webapp/i18n/en/course.json +++ b/src/main/webapp/i18n/en/course.json @@ -93,7 +93,11 @@ }, "messagingEnabled": { "label": "Messaging Enabled", - "tooltip": "Enables messaging between course users in private or public channels, group chats or direct messages. Channels can only be created by instructors and tutors. Users can self-join public channels and must be invited to private channels. Every user can start a private group chat and add other users. A group chat is limited to 10 members. Every user can start a private one-to-one chat with another user. The chats happens in the messaging space of the course." + "tooltip": "Enables messaging between course users in private or public channels, group chats or direct messages. Channels can only be created by instructors and tutors. Users can self-join public channels and must be invited to private channels. Every user can start a private group chat and add other users. A group chat is limited to 10 members. Every user can start a private one-to-one chat with another user. The chats happens in the messaging space of the course.", + "codeOfConduct": { + "label": "Code of Conduct", + "tooltip": "The Code of Conduct describes to users how best to communicate and which consequences might be raised if there is misconduct, as well as, contact information for reporting." + } } }, "registrationEnabled": { diff --git a/src/test/java/de/tum/in/www1/artemis/assessment/ResultServiceIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/assessment/ResultServiceIntegrationTest.java index e071bf93380e..3dfa4d907083 100644 --- a/src/test/java/de/tum/in/www1/artemis/assessment/ResultServiceIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/assessment/ResultServiceIntegrationTest.java @@ -238,7 +238,7 @@ void setProgrammingExerciseResultRated(boolean shouldBeRated, ZonedDateTime buil @Test @WithMockUser(username = TEST_PREFIX + "instructor1", roles = "INSTRUCTOR") void testTestRunsNonRated() { - programmingExerciseStudentParticipation.setTestRun(true); + programmingExerciseStudentParticipation.setPracticeMode(true); programmingExerciseStudentParticipation = programmingExerciseStudentParticipationRepository.save(programmingExerciseStudentParticipation); var submission = (ProgrammingSubmission) new ProgrammingSubmission().commitHash("abc").type(SubmissionType.MANUAL).submitted(true); diff --git a/src/test/java/de/tum/in/www1/artemis/course/CourseTestService.java b/src/test/java/de/tum/in/www1/artemis/course/CourseTestService.java index bd77cb71ecaa..ed857f5a52ee 100644 --- a/src/test/java/de/tum/in/www1/artemis/course/CourseTestService.java +++ b/src/test/java/de/tum/in/www1/artemis/course/CourseTestService.java @@ -946,7 +946,7 @@ public void testGetCoursesForDashboardPracticeRepositories() throws Exception { programmingExerciseUtilService.addProgrammingSubmissionToResultAndParticipation(gradedResult, gradedParticipation, "asdf"); StudentParticipation practiceParticipation = ParticipationFactory.generateProgrammingExerciseStudentParticipation(InitializationState.INITIALIZED, programmingExercise, student1); - practiceParticipation.setTestRun(true); + practiceParticipation.setPracticeMode(true); participationRepository.save(practiceParticipation); Result practiceResult = participationUtilService.addResultToParticipation(AssessmentType.AUTOMATIC, ZonedDateTime.now().minusHours(1), practiceParticipation); practiceResult.setRated(false); diff --git a/src/test/java/de/tum/in/www1/artemis/course/CourseUtilService.java b/src/test/java/de/tum/in/www1/artemis/course/CourseUtilService.java index fe523238414d..cc68fa3725bf 100644 --- a/src/test/java/de/tum/in/www1/artemis/course/CourseUtilService.java +++ b/src/test/java/de/tum/in/www1/artemis/course/CourseUtilService.java @@ -290,7 +290,7 @@ public List createCoursesWithExercisesAndLectures(String prefix, boolean StudentParticipation participation3 = ParticipationFactory.generateStudentParticipation(InitializationState.UNINITIALIZED, modelingExercise, user); StudentParticipation participation4 = ParticipationFactory.generateProgrammingExerciseStudentParticipation(InitializationState.FINISHED, programmingExercise, user); StudentParticipation participation5 = ParticipationFactory.generateProgrammingExerciseStudentParticipation(InitializationState.INITIALIZED, programmingExercise, user); - participation5.setTestRun(true); + participation5.setPracticeMode(true); Submission modelingSubmission1 = ParticipationFactory.generateModelingSubmission("model1", true); Submission modelingSubmission2 = ParticipationFactory.generateModelingSubmission("model2", true); diff --git a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseIntegrationTestService.java b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseIntegrationTestService.java index 564dbd60afb2..8b3a6699c17d 100644 --- a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseIntegrationTestService.java +++ b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseIntegrationTestService.java @@ -303,8 +303,8 @@ List exportSubmissionsWithPracticeSubmissionByParticipationIds(boolean exc doReturn(repository2).when(gitService).getOrCheckoutRepository(eq(participation2.getVcsRepositoryUrl()), anyString(), anyBoolean()); // Set one of the participations to practice mode - participation1.setTestRun(false); - participation2.setTestRun(true); + participation1.setPracticeMode(false); + participation2.setPracticeMode(true); final var participations = List.of(participation1, participation2); programmingExerciseStudentParticipationRepository.saveAll(participations); diff --git a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseParticipationIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseParticipationIntegrationTest.java index bed74e3d4160..79ebb1edaadf 100644 --- a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseParticipationIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseParticipationIntegrationTest.java @@ -427,7 +427,7 @@ void checkResetRepository_noAccess_forbidden() throws Exception { void checkResetRepository_noAccessToGradedParticipation_forbidden() throws Exception { var gradedParticipation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, TEST_PREFIX + "student2"); var practiceParticipation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, TEST_PREFIX + "student1"); - practiceParticipation.setTestRun(true); + practiceParticipation.setPracticeMode(true); participationRepository.save(practiceParticipation); request.put("/api/programming-exercise-participations/" + practiceParticipation.getId() + "/reset-repository?gradedParticipationId=" + gradedParticipation.getId(), null, diff --git a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTest.java b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTest.java index 2e8c72b59314..00a610275474 100644 --- a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTest.java +++ b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTest.java @@ -219,7 +219,7 @@ void testFindRelevantParticipations() { gradedParticipationFinished.setInitializationState(InitializationState.FINISHED); gradedParticipationFinished.setExercise(exercise); StudentParticipation practiceParticipation = new StudentParticipation(); - practiceParticipation.setTestRun(true); + practiceParticipation.setPracticeMode(true); practiceParticipation.setExercise(exercise); List allParticipations = List.of(gradedParticipationInitialized, gradedParticipationFinished, practiceParticipation); diff --git a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingSubmissionAndResultBitbucketBambooIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingSubmissionAndResultBitbucketBambooIntegrationTest.java index 8a94261d32cd..2350f2b45477 100644 --- a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingSubmissionAndResultBitbucketBambooIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingSubmissionAndResultBitbucketBambooIntegrationTest.java @@ -949,7 +949,7 @@ void shouldCreateGradleFeedback() throws Exception { @ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}") @MethodSource("testSubmissionAfterDueDateValues") @WithMockUser(username = TEST_PREFIX + "student1", roles = "USER") - void testSubmissionAfterDueDate(ZonedDateTime dueDate, SubmissionType expectedType, boolean expectedRated, boolean testRun) throws Exception { + void testSubmissionAfterDueDate(ZonedDateTime dueDate, SubmissionType expectedType, boolean expectedRated, boolean practiceMode) throws Exception { var user = userRepository.findUserWithGroupsAndAuthoritiesByLogin(TEST_PREFIX + "student1").orElseThrow(); Course course = programmingExerciseUtilService.addCourseWithOneProgrammingExercise(); @@ -959,8 +959,8 @@ void testSubmissionAfterDueDate(ZonedDateTime dueDate, SubmissionType expectedTy // Add a participation for the programming exercise var participation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, user.getLogin()); - if (testRun) { - participation.setTestRun(testRun); + if (practiceMode) { + participation.setPracticeMode(practiceMode); participation = participationRepository.save(participation); } diff --git a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/RepositoryIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/RepositoryIntegrationTest.java index 88baf78befc3..f2f2f9cc0494 100644 --- a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/RepositoryIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/RepositoryIntegrationTest.java @@ -888,7 +888,7 @@ void testCommitChangesAllowedForPracticeModeAfterDueDate() throws Exception { programmingExercise.setAssessmentType(AssessmentType.MANUAL); programmingExerciseRepository.save(programmingExercise); - participation.setTestRun(true); + participation.setPracticeMode(true); studentParticipationRepository.save(participation); testCommitChanges(); diff --git a/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIIntegrationTest.java index a071df4a63c6..2b763da0c2fc 100644 --- a/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIIntegrationTest.java @@ -636,7 +636,7 @@ void testFetchPush_studentPracticeRepository() throws Exception { // Create practice participation. ProgrammingExerciseStudentParticipation practiceParticipation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, student1Login); - practiceParticipation.setTestRun(true); + practiceParticipation.setPracticeMode(true); practiceParticipation.setRepositoryUrl(localVCLocalCITestService.constructLocalVCUrl("", "", projectKey1, practiceRepositorySlug)); programmingExerciseStudentParticipationRepository.save(practiceParticipation); @@ -682,7 +682,7 @@ void testFetchPush_teachingAssistantPracticeRepository() throws Exception { // Create practice participation. ProgrammingExerciseStudentParticipation practiceParticipation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, tutor1Login); - practiceParticipation.setTestRun(true); + practiceParticipation.setPracticeMode(true); programmingExerciseStudentParticipationRepository.save(practiceParticipation); // Students should not be able to access, teaching assistants should be able to fetch and push and editors and higher should be able to fetch and push. @@ -721,7 +721,7 @@ void testFetchPush_instructorPracticeRepository() throws Exception { // Create practice participation. ProgrammingExerciseStudentParticipation practiceParticipation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, instructor1Login); - practiceParticipation.setTestRun(true); + practiceParticipation.setPracticeMode(true); programmingExerciseStudentParticipationRepository.save(practiceParticipation); // Students should not be able to access, teaching assistants should be able to fetch, and editors and higher should be able to fetch and push. diff --git a/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIParticipationIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIParticipationIntegrationTest.java index 9f93d1fa34e1..512daad3da8f 100644 --- a/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIParticipationIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/localvcci/LocalVCLocalCIParticipationIntegrationTest.java @@ -55,7 +55,7 @@ void testStartParticipation() throws Exception { StudentParticipation participation = request.postWithResponseBody("/api/exercises/" + programmingExercise.getId() + "/participations", null, StudentParticipation.class, HttpStatus.CREATED); assertThat(participation).isNotNull(); - assertThat(participation.isTestRun()).isFalse(); + assertThat(participation.isPracticeMode()).isFalse(); assertThat(participation.getStudent()).contains(user); LocalVCRepositoryUrl studentAssignmentRepositoryUrl = new LocalVCRepositoryUrl(projectKey, projectKey.toLowerCase() + "-" + TEST_PREFIX + "student1", localVCBaseUrl); assertThat(studentAssignmentRepositoryUrl.getLocalRepositoryPath(localVCBasePath)).exists(); diff --git a/src/test/java/de/tum/in/www1/artemis/participation/ParticipationIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/participation/ParticipationIntegrationTest.java index 4255a6dec31a..c3b757d87240 100644 --- a/src/test/java/de/tum/in/www1/artemis/participation/ParticipationIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/participation/ParticipationIntegrationTest.java @@ -306,7 +306,7 @@ void participateInProgrammingExerciseAsEditorDueDatePassed() throws Exception { HttpStatus.CREATED); var participationUsers = participation.getStudents(); assertThat(participation).isNotNull(); - assertThat(participation.isTestRun()).isFalse(); + assertThat(participation.isPracticeMode()).isFalse(); assertThat(participationUsers).contains(user); } @@ -339,7 +339,7 @@ void practiceProgrammingExercise_successful() throws Exception { StudentParticipation participation = request.postWithResponseBody("/api/exercises/" + programmingExercise.getId() + "/participations/practice", null, StudentParticipation.class, HttpStatus.CREATED); assertThat(participation).isNotNull(); - assertThat(participation.isTestRun()).isTrue(); + assertThat(participation.isPracticeMode()).isTrue(); assertThat(participation.getStudent()).contains(user); } @@ -354,7 +354,7 @@ void participateInProgrammingExercise_successful() throws Exception { StudentParticipation participation = request.postWithResponseBody("/api/exercises/" + programmingExercise.getId() + "/participations", null, StudentParticipation.class, HttpStatus.CREATED); assertThat(participation).isNotNull(); - assertThat(participation.isTestRun()).isFalse(); + assertThat(participation.isPracticeMode()).isFalse(); assertThat(participation.getStudent()).contains(user); } @@ -593,7 +593,7 @@ void getAllParticipationsForExercise() throws Exception { participationUtilService.createAndSaveParticipationForExercise(textExercise, TEST_PREFIX + "student1"); participationUtilService.createAndSaveParticipationForExercise(textExercise, TEST_PREFIX + "student2"); StudentParticipation testParticipation = participationUtilService.createAndSaveParticipationForExercise(textExercise, TEST_PREFIX + "student3"); - testParticipation.setTestRun(true); + testParticipation.setPracticeMode(true); participationRepo.save(testParticipation); var participations = request.getList("/api/exercises/" + textExercise.getId() + "/participations", HttpStatus.OK, StudentParticipation.class); assertThat(participations).as("Exactly 3 participations are returned").hasSize(3).as("Only participation that has student are returned") @@ -617,7 +617,7 @@ void getAllParticipationsForExercise_withLatestResults() throws Exception { Submission onlySubmission = textExerciseUtilService.createSubmissionForTextExercise(textExercise, students.get(2), "asdf"); StudentParticipation testParticipation = participationUtilService.createAndSaveParticipationForExercise(textExercise, TEST_PREFIX + "student4"); - testParticipation.setTestRun(true); + testParticipation.setPracticeMode(true); participationRepo.save(testParticipation); final var params = new LinkedMultiValueMap(); @@ -1066,7 +1066,7 @@ void getSubmissionOfParticipation() throws Exception { @WithMockUser(username = TEST_PREFIX + "instructor1", roles = "INSTRUCTOR") void cleanupBuildPlan(boolean practiceMode, boolean afterDueDate) throws Exception { var participation = participationUtilService.addStudentParticipationForProgrammingExercise(programmingExercise, TEST_PREFIX + "student1"); - participation.setTestRun(practiceMode); + participation.setPracticeMode(practiceMode); participationRepo.save(participation); if (afterDueDate) { programmingExercise.setDueDate(ZonedDateTime.now().minusHours(1)); diff --git a/src/test/java/de/tum/in/www1/artemis/service/ParticipationServiceTest.java b/src/test/java/de/tum/in/www1/artemis/service/ParticipationServiceTest.java index 2e87e4cca224..083965aa0378 100644 --- a/src/test/java/de/tum/in/www1/artemis/service/ParticipationServiceTest.java +++ b/src/test/java/de/tum/in/www1/artemis/service/ParticipationServiceTest.java @@ -183,7 +183,7 @@ void testStartPracticeMode(boolean useGradedParticipation) throws URISyntaxExcep StudentParticipation studentParticipationReceived = participationService.startPracticeMode(programmingExercise, participant, Optional.of((StudentParticipation) gradedResult.getParticipation()), useGradedParticipation); - assertThat(studentParticipationReceived.isTestRun()).isTrue(); + assertThat(studentParticipationReceived.isPracticeMode()).isTrue(); assertThat(studentParticipationReceived.getExercise()).isEqualTo(programmingExercise); assertThat(studentParticipationReceived.getStudent()).isPresent(); assertThat(studentParticipationReceived.getStudent().get()).isEqualTo(participant); diff --git a/src/test/javascript/spec/component/course/course-update.component.spec.ts b/src/test/javascript/spec/component/course/course-update.component.spec.ts index bc5e82b7cff1..cee5192b8d4b 100644 --- a/src/test/javascript/spec/component/course/course-update.component.spec.ts +++ b/src/test/javascript/spec/component/course/course-update.component.spec.ts @@ -14,6 +14,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; import { HasAnyAuthorityDirective } from 'app/shared/auth/has-any-authority.directive'; import { ColorSelectorComponent } from 'app/shared/color-selector/color-selector.component'; import { FormDateTimePickerComponent } from 'app/shared/date-time-picker/date-time-picker.component'; +import { HelpIconComponent } from 'app/shared/components/help-icon.component'; import { SecuredImageComponent } from 'app/shared/image/secured-image.component'; import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe'; import { MockComponent, MockDirective, MockModule, MockPipe, MockProvider } from 'ng-mocks'; @@ -107,13 +108,14 @@ describe('Course Management Update Component', () => { declarations: [ CourseUpdateComponent, MarkdownEditorStubComponent, - MockPipe(ArtemisTranslatePipe), - MockComponent(SecuredImageComponent), - MockComponent(FormDateTimePickerComponent), MockComponent(ColorSelectorComponent), + MockComponent(FormDateTimePickerComponent), + MockComponent(HelpIconComponent), + MockComponent(SecuredImageComponent), + MockDirective(FeatureToggleHideDirective), MockDirective(HasAnyAuthorityDirective), MockDirective(TranslateDirective), - MockDirective(FeatureToggleHideDirective), + MockPipe(ArtemisTranslatePipe), MockPipe(RemoveKeysPipe), ], })