From 728551cdfa5ace6d9c63acf367ac09f664531bd3 Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Wed, 21 Aug 2024 12:14:02 +0200 Subject: [PATCH 01/13] add notification type for changes in test repository for exam exercises --- .../artemis/domain/enumeration/NotificationType.java | 7 ++++--- .../notification/GroupNotificationFactory.java | 9 ++++++++- .../domain/notification/NotificationConstants.java | 12 +++++++++--- .../notifications/GroupNotificationService.java | 2 +- .../notifications/NotificationSettingsService.java | 1 + .../programming/ProgrammingTriggerService.java | 7 ++++--- src/main/webapp/app/entities/notification.model.ts | 2 ++ .../notification-settings-structure.ts | 2 +- .../notification-settings.service.ts | 1 + 9 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java b/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java index db6dd37894b4..fb65f33a8724 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java @@ -1,11 +1,12 @@ package de.tum.in.www1.artemis.domain.enumeration; +// TODO Michal Kawka public enum NotificationType { EXERCISE_SUBMISSION_ASSESSED, ATTACHMENT_CHANGE, EXERCISE_RELEASED, EXERCISE_PRACTICE, QUIZ_EXERCISE_STARTED, EXERCISE_UPDATED, NEW_REPLY_FOR_EXERCISE_POST, NEW_REPLY_FOR_LECTURE_POST, NEW_REPLY_FOR_COURSE_POST, NEW_REPLY_FOR_EXAM_POST, NEW_EXERCISE_POST, NEW_LECTURE_POST, NEW_COURSE_POST, NEW_ANNOUNCEMENT_POST, NEW_EXAM_POST, - FILE_SUBMISSION_SUCCESSFUL, COURSE_ARCHIVE_STARTED, COURSE_ARCHIVE_FINISHED, COURSE_ARCHIVE_FAILED, PROGRAMMING_TEST_CASES_CHANGED, DUPLICATE_TEST_CASE, EXAM_ARCHIVE_STARTED, - EXAM_ARCHIVE_FINISHED, EXAM_ARCHIVE_FAILED, ILLEGAL_SUBMISSION, NEW_PLAGIARISM_CASE_STUDENT, NEW_CPC_PLAGIARISM_CASE_STUDENT, PLAGIARISM_CASE_VERDICT_STUDENT, - NEW_MANUAL_FEEDBACK_REQUEST, TUTORIAL_GROUP_REGISTRATION_STUDENT, TUTORIAL_GROUP_DEREGISTRATION_STUDENT, TUTORIAL_GROUP_REGISTRATION_TUTOR, + FILE_SUBMISSION_SUCCESSFUL, COURSE_ARCHIVE_STARTED, COURSE_ARCHIVE_FINISHED, COURSE_ARCHIVE_FAILED, PROGRAMMING_TEST_CASES_CHANGED, PROGRAMMING_EXAM_TEST_CASES_CHANGED, + DUPLICATE_TEST_CASE, EXAM_ARCHIVE_STARTED, EXAM_ARCHIVE_FINISHED, EXAM_ARCHIVE_FAILED, ILLEGAL_SUBMISSION, NEW_PLAGIARISM_CASE_STUDENT, NEW_CPC_PLAGIARISM_CASE_STUDENT, + PLAGIARISM_CASE_VERDICT_STUDENT, NEW_MANUAL_FEEDBACK_REQUEST, TUTORIAL_GROUP_REGISTRATION_STUDENT, TUTORIAL_GROUP_DEREGISTRATION_STUDENT, TUTORIAL_GROUP_REGISTRATION_TUTOR, TUTORIAL_GROUP_MULTIPLE_REGISTRATION_TUTOR, TUTORIAL_GROUP_DEREGISTRATION_TUTOR, TUTORIAL_GROUP_DELETED, TUTORIAL_GROUP_UPDATED, TUTORIAL_GROUP_ASSIGNED, TUTORIAL_GROUP_UNASSIGNED, CONVERSATION_NEW_MESSAGE, CONVERSATION_NEW_REPLY_MESSAGE, CONVERSATION_USER_MENTIONED, CONVERSATION_CREATE_ONE_TO_ONE_CHAT, CONVERSATION_CREATE_GROUP_CHAT, CONVERSATION_ADD_USER_GROUP_CHAT, CONVERSATION_ADD_USER_CHANNEL, CONVERSATION_REMOVE_USER_GROUP_CHAT, CONVERSATION_REMOVE_USER_CHANNEL, diff --git a/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java b/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java index d01f11772411..3229028ebecb 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java @@ -17,6 +17,7 @@ import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.NEW_ANNOUNCEMENT_POST; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.NEW_MANUAL_FEEDBACK_REQUEST; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_BUILD_RUN_UPDATE; +import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_EXAM_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_REPOSITORY_LOCKS; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.QUIZ_EXERCISE_STARTED; @@ -155,6 +156,12 @@ public static GroupNotification createNotification(Exercise exercise, User autho text = NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TEXT; textIsPlaceholder = true; } + case PROGRAMMING_EXAM_TEST_CASES_CHANGED -> { + title = NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TITLE; + text = NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TEXT; + textIsPlaceholder = true; + priority = HIGH; + } case NEW_MANUAL_FEEDBACK_REQUEST -> { title = NotificationConstants.NEW_MANUAL_FEEDBACK_REQUEST_TITLE; text = NotificationConstants.NEW_MANUAL_FEEDBACK_REQUEST_TEXT; @@ -221,7 +228,7 @@ else if (notificationType == DUPLICATE_TEST_CASE) { } @NotificationPlaceholderCreator(values = { EXERCISE_RELEASED, EXERCISE_PRACTICE, QUIZ_EXERCISE_STARTED, EXERCISE_UPDATED, PROGRAMMING_TEST_CASES_CHANGED, - NEW_MANUAL_FEEDBACK_REQUEST, DUPLICATE_TEST_CASE, PROGRAMMING_REPOSITORY_LOCKS, PROGRAMMING_BUILD_RUN_UPDATE, ILLEGAL_SUBMISSION }) + PROGRAMMING_EXAM_TEST_CASES_CHANGED, NEW_MANUAL_FEEDBACK_REQUEST, DUPLICATE_TEST_CASE, PROGRAMMING_REPOSITORY_LOCKS, PROGRAMMING_BUILD_RUN_UPDATE, ILLEGAL_SUBMISSION }) public static String[] createPlaceholderExerciseNotification(String courseTitle, String exerciseTitle) { return new String[] { courseTitle, exerciseTitle }; } diff --git a/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java b/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java index 8cc7856afdf7..38fe7e56b629 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java @@ -40,6 +40,7 @@ import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.NEW_REPLY_FOR_LECTURE_POST; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PLAGIARISM_CASE_VERDICT_STUDENT; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_BUILD_RUN_UPDATE; +import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_EXAM_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_REPOSITORY_LOCKS; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.QUIZ_EXERCISE_STARTED; @@ -58,6 +59,7 @@ import de.tum.in.www1.artemis.domain.enumeration.NotificationType; +// TODO Michal Kawka public class NotificationConstants { // Titles @@ -117,6 +119,8 @@ public class NotificationConstants { public static final String PROGRAMMING_TEST_CASES_CHANGED_TITLE = "artemisApp.groupNotification.title.programmingTestCasesChanged"; + public static final String PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE = "artemisApp.groupNotification.title.programmingExamTestCasesChanged"; + public static final String NEW_MANUAL_FEEDBACK_REQUEST_TITLE = "artemisApp.groupNotification.title.newManualFeedbackRequest"; public static final String PROGRAMMING_REPOSITORY_LOCKS_TITLE = "artemisApp.groupNotification.title.repositoryLocks"; @@ -210,6 +214,8 @@ public class NotificationConstants { public static final String PROGRAMMING_TEST_CASES_CHANGED_TEXT = "artemisApp.groupNotification.text.programmingTestCasesChanged"; + public static final String PROGRAMMING_EXAM_TEST_CASES_CHANGED_TEXT = "artemisApp.groupNotification.text.programmingExamTestCasesChanged"; + public static final String NEW_MANUAL_FEEDBACK_REQUEST_TEXT = "artemisApp.groupNotification.text.newManualFeedbackRequest"; public static final String NEW_PLAGIARISM_CASE_STUDENT_TEXT = "artemisApp.singleUserNotification.text.newPlagiarismCaseStudent"; @@ -292,9 +298,9 @@ public class NotificationConstants { .put(NEW_ANNOUNCEMENT_POST, NEW_ANNOUNCEMENT_POST_TITLE).put(COURSE_ARCHIVE_FINISHED, COURSE_ARCHIVE_FINISHED_TITLE) .put(COURSE_ARCHIVE_FAILED, COURSE_ARCHIVE_FAILED_TITLE).put(EXAM_ARCHIVE_STARTED, EXAM_ARCHIVE_STARTED_TITLE).put(EXAM_ARCHIVE_FAILED, EXAM_ARCHIVE_FAILED_TITLE) .put(EXAM_ARCHIVE_FINISHED, EXAM_ARCHIVE_FINISHED_TITLE).put(PROGRAMMING_TEST_CASES_CHANGED, PROGRAMMING_TEST_CASES_CHANGED_TITLE) - .put(NEW_MANUAL_FEEDBACK_REQUEST, NEW_MANUAL_FEEDBACK_REQUEST_TITLE).put(NEW_PLAGIARISM_CASE_STUDENT, NEW_PLAGIARISM_CASE_STUDENT_TITLE) - .put(NEW_CPC_PLAGIARISM_CASE_STUDENT, NEW_CPC_PLAGIARISM_CASE_STUDENT_TITLE).put(PLAGIARISM_CASE_VERDICT_STUDENT, PLAGIARISM_CASE_VERDICT_STUDENT_TITLE) - .put(TUTORIAL_GROUP_REGISTRATION_STUDENT, TUTORIAL_GROUP_REGISTRATION_STUDENT_TITLE) + .put(PROGRAMMING_EXAM_TEST_CASES_CHANGED, PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE).put(NEW_MANUAL_FEEDBACK_REQUEST, NEW_MANUAL_FEEDBACK_REQUEST_TITLE) + .put(NEW_PLAGIARISM_CASE_STUDENT, NEW_PLAGIARISM_CASE_STUDENT_TITLE).put(NEW_CPC_PLAGIARISM_CASE_STUDENT, NEW_CPC_PLAGIARISM_CASE_STUDENT_TITLE) + .put(PLAGIARISM_CASE_VERDICT_STUDENT, PLAGIARISM_CASE_VERDICT_STUDENT_TITLE).put(TUTORIAL_GROUP_REGISTRATION_STUDENT, TUTORIAL_GROUP_REGISTRATION_STUDENT_TITLE) .put(TUTORIAL_GROUP_DEREGISTRATION_STUDENT, TUTORIAL_GROUP_DEREGISTRATION_STUDENT_TITLE).put(TUTORIAL_GROUP_REGISTRATION_TUTOR, TUTORIAL_GROUP_REGISTRATION_TUTOR_TITLE) .put(TUTORIAL_GROUP_DEREGISTRATION_TUTOR, TUTORIAL_GROUP_DEREGISTRATION_TUTOR_TITLE).put(TUTORIAL_GROUP_DELETED, TUTORIAL_GROUP_DELETED_TITLE) .put(TUTORIAL_GROUP_UPDATED, TUTORIAL_GROUP_UPDATED_TITLE).put(TUTORIAL_GROUP_MULTIPLE_REGISTRATION_TUTOR, TUTORIAL_GROUP_REGISTRATION_MULTIPLE_TUTOR_TITLE) diff --git a/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java b/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java index c4c0d8898009..967cd0d70115 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java @@ -140,7 +140,7 @@ private void notifyGroupsWithNotificationType(GroupNotificationType[] groups, No case DUPLICATE_TEST_CASE, ILLEGAL_SUBMISSION, PROGRAMMING_REPOSITORY_LOCKS, PROGRAMMING_BUILD_RUN_UPDATE -> createNotification((Exercise) notificationSubject, author, group, notificationType, (String) typeSpecificInformation); // Additional Types - case PROGRAMMING_TEST_CASES_CHANGED, NEW_MANUAL_FEEDBACK_REQUEST -> + case PROGRAMMING_TEST_CASES_CHANGED, PROGRAMMING_EXAM_TEST_CASES_CHANGED, NEW_MANUAL_FEEDBACK_REQUEST -> createNotification((Exercise) notificationSubject, author, group, notificationType, (String) typeSpecificInformation); default -> throw new UnsupportedOperationException("Unsupported NotificationType: " + notificationType); }; diff --git a/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java b/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java index c2ea32679fb8..321b643b7892 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java @@ -64,6 +64,7 @@ @Profile(PROFILE_CORE) @Service +// TODO Michal Kawka public class NotificationSettingsService { private final NotificationSettingRepository notificationSettingRepository; diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java index 901f25d03311..38732fb61ab8 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java @@ -149,9 +149,10 @@ private void setTestCasesChanged(ProgrammingExercise programmingExercise, boolea boolean resultsExist = resultRepository.existsByParticipation_ExerciseId(programmingExercise.getId()); - if (testCasesChanged == programmingExercise.getTestCasesChanged() || (!resultsExist && testCasesChanged)) { - return; - } + // if (testCasesChanged == programmingExercise.getTestCasesChanged() || (!resultsExist && testCasesChanged)) { + // return; + // } + programmingExercise.setTestCasesChanged(testCasesChanged); ProgrammingExercise updatedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); // Send a websocket message about the new state to the client. diff --git a/src/main/webapp/app/entities/notification.model.ts b/src/main/webapp/app/entities/notification.model.ts index 8563d65b4be5..dd557fb0f2a1 100644 --- a/src/main/webapp/app/entities/notification.model.ts +++ b/src/main/webapp/app/entities/notification.model.ts @@ -79,6 +79,8 @@ export const EXAM_ARCHIVE_FAILED_TITLE = 'artemisApp.groupNotification.title.exa export const PROGRAMMING_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingTestCasesChanged'; +export const PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingExamTestCasesChanged'; + export const NEW_MANUAL_FEEDBACK_REQUEST_TITLE = 'artemisApp.groupNotification.title.newManualFeedbackRequest'; export const NEW_PLAGIARISM_CASE_STUDENT_TITLE = 'artemisApp.singleUserNotification.title.newPlagiarismCaseStudent'; diff --git a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts index 643427735110..8f3da86abbe8 100644 --- a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts +++ b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts @@ -14,7 +14,7 @@ export interface NotificationSetting extends Setting { // If left undefined emailSupport will count as false/deactivated emailSupport?: boolean; } - +//TODO Michal Kawka export const notificationSettingsStructure: UserSettingsStructure = { category: UserSettingsCategory.NOTIFICATION_SETTINGS, groups: [ diff --git a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts index a2f5300a1bd9..e92a28ee648e 100644 --- a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts +++ b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts @@ -46,6 +46,7 @@ import { Observable, ReplaySubject } from 'rxjs'; export const reloadNotificationSideBarMessage = 'reloadNotificationsInNotificationSideBar'; +//TODO Michal Kawka @Injectable({ providedIn: 'root' }) export class NotificationSettingsService { /** From fbfac72678668bd3a28c8570a2348141fc3377fb Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Wed, 21 Aug 2024 22:27:08 +0200 Subject: [PATCH 02/13] add notification translations --- src/main/webapp/i18n/de/notification.json | 2 ++ src/main/webapp/i18n/en/notification.json | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/webapp/i18n/de/notification.json b/src/main/webapp/i18n/de/notification.json index bc479b170f0b..9942102c0454 100644 --- a/src/main/webapp/i18n/de/notification.json +++ b/src/main/webapp/i18n/de/notification.json @@ -50,6 +50,7 @@ "liveExamExerciseUpdate": "Klausuraufgabe aktualisiert", "exerciseUpdated": "Aufgabe aktualisiert", "programmingTestCasesChanged": "Testfälle für Programmieraufgaben geändert", + "programmingExamTestCasesChanged": "Die Testfälle für Klausurprogrammieraufgaben wurden geändert.", "newManualFeedbackRequest": "Eine neue Anfrage zu manuellem Feedback wurde eingereicht", "duplicateTestCase": "Doppelte Testfälle wurden gefunden.", "repositoryLocks": "Repository-Berechtigungen aktualisiert", @@ -79,6 +80,7 @@ "liveExamExerciseUpdate": "Die Klausuraufgabe \"{{ placeholderValues.1 }}\" wurde aktualisiert.", "exerciseUpdated": "Die Aufgabe \"{{ placeholderValues.1 }}\" im Kurs \"{{ placeholderValues.0 }}\" wurde aktualisiert.", "programmingTestCasesChanged": "Die Testfälle der Programmieraufgabe \"{{ placeholderValues.1 }}\" im Kurs \"{{ placeholderValues.0 }}\" wurden aktualisiert. Die Abgaben der Studenten sollten erneut gebaut und getestet werden, um neue Ergebnisse zu erstellen.", + "programmingExamTestCasesChanged": "Die Testfälle der Programmieraufgabe \"{{ placeholderValues.1 }}\" in der Klausur \"{{ placeholderValues.0 }}\" wurden aktualisiert. Die Abgaben der Studenten sollten erneut gebaut und getestet werden, um neue Ergebnisse zu erstellen.", "newManualFeedbackRequest": "Die Programmieraufgabe \"{{ placeholderValues.1 }}\" im Kurs \"{{ placeholderValues.0 }}\" hat eine neue manuelle Feedbackanfrage. Bitte bewerte das Feedback vor der Einreichungsfrist.", "illegalSubmission": "Die Aufgabe \"{{ placeholderValues.1 }}\" im Kurs \"{{ placeholderValues.0 }}\" hat illegale Abgaben von Studenten.", "newExercisePost": "Die Aufgabe \"{{ placeholderValues.5 }}\" im Kurs \"{{ placeholderValues.0 }}\" hat einen neuen Beitrag: \"{{ placeholderValues.2 }}\"", diff --git a/src/main/webapp/i18n/en/notification.json b/src/main/webapp/i18n/en/notification.json index a027df9ace12..c96fcf0f0176 100644 --- a/src/main/webapp/i18n/en/notification.json +++ b/src/main/webapp/i18n/en/notification.json @@ -50,6 +50,7 @@ "liveExamExerciseUpdate": "Live exam exercise update", "exerciseUpdated": "Exercise updated", "programmingTestCasesChanged": "Test cases for programming exercise changed", + "programmingExamTestCasesChanged": "Test cases for exam programming exercise changed", "newManualFeedbackRequest": "A new manual feedback request has been submitted", "duplicateTestCase": "Duplicate test case was found.", "repositoryLocks": "Repository permissions changed", @@ -79,6 +80,7 @@ "liveExamExerciseUpdate": "The exam Exercise \"{{ placeholderValues.1 }}\" got updated.", "exerciseUpdated": "The exercise \"{{ placeholderValues.1 }}\" in course \"{{ placeholderValues.0 }}\" got updated.", "programmingTestCasesChanged": "The test cases of the programming exercise \"{{ placeholderValues.1 }}\" in the course \"{{ placeholderValues.0 }}\" were updated. The students' submissions should be rebuilt and tested in order to create new results.", + "programmingExamTestCasesChanged": "The test cases of the programming exercise \"{{ placeholderValues.1 }}\" in the exam \"{{ placeholderValues.0 }}\" were updated. The students' submissions should be rebuilt and tested in order to create new results.", "newManualFeedbackRequest": "The programming exercise \"{{ placeholderValues.1 }}\" in the course \"{{ placeholderValues.0 }}\" has a new manual feedback request. Please assess the feedback before the due date.", "illegalSubmission": "The exercise \"{{ placeholderValues.1 }}\" has illegal submissions of students.", "newExercisePost": "The exercise \"{{ placeholderValues.5 }}\" in the course \"{{ placeholderValues.0 }}\" got a new post: \"{{ placeholderValues.2 }}\"", From e73bf0c46f945eea28178d361c56e793ff57ee1f Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Wed, 21 Aug 2024 22:27:30 +0200 Subject: [PATCH 03/13] add notification to notification.model.ts --- src/main/webapp/app/entities/notification.model.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/app/entities/notification.model.ts b/src/main/webapp/app/entities/notification.model.ts index dd557fb0f2a1..4daae3609adc 100644 --- a/src/main/webapp/app/entities/notification.model.ts +++ b/src/main/webapp/app/entities/notification.model.ts @@ -79,7 +79,7 @@ export const EXAM_ARCHIVE_FAILED_TITLE = 'artemisApp.groupNotification.title.exa export const PROGRAMMING_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingTestCasesChanged'; -export const PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingExamTestCasesChanged'; +export const PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingTestCasesChanged'; export const NEW_MANUAL_FEEDBACK_REQUEST_TITLE = 'artemisApp.groupNotification.title.newManualFeedbackRequest'; From eb4f595a2bd2f724fd1dc1d0302b8625a760fa34 Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Wed, 21 Aug 2024 22:28:21 +0200 Subject: [PATCH 04/13] =?UTF-8?q?implement=20changes=20in=20the=20factory?= =?UTF-8?q?=20and=20service=CB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GroupNotificationFactory.java | 19 ++++++++++++++++--- .../GroupNotificationService.java | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java b/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java index 3229028ebecb..ef2614d1e8b8 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactory.java @@ -121,7 +121,13 @@ public static GroupNotification createNotification(Exercise exercise, User autho String title; String text; boolean textIsPlaceholder; - String[] placeholderValues = createPlaceholderExerciseNotification(exercise.getCourseViaExerciseGroupOrCourseMember().getTitle(), exercise.getTitle()); + String[] placeholderValues; + if (exercise.isExamExercise()) { + placeholderValues = createPlaceholderExamExerciseNotification(exercise.getExam().getTitle(), exercise.getTitle()); + } + else { + placeholderValues = createPlaceholderExerciseNotification(exercise.getCourseViaExerciseGroupOrCourseMember().getTitle(), exercise.getTitle()); + } NotificationPriority priority = MEDIUM; switch (notificationType) { @@ -157,8 +163,8 @@ public static GroupNotification createNotification(Exercise exercise, User autho textIsPlaceholder = true; } case PROGRAMMING_EXAM_TEST_CASES_CHANGED -> { - title = NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TITLE; - text = NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TEXT; + title = NotificationConstants.PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE; + text = NotificationConstants.PROGRAMMING_EXAM_TEST_CASES_CHANGED_TEXT; textIsPlaceholder = true; priority = HIGH; } @@ -210,6 +216,7 @@ public static GroupNotification createNotification(Exercise exercise, User autho notification.setTransientAndStringTarget(createExamExerciseTargetWithExerciseUpdate(exercise)); notification.setPriority(HIGH); } + else if (exercise instanceof ProgrammingExercise programmingExercise) { notification.setTransientAndStringTarget(createExamProgrammingExerciseOrTestCaseTarget(programmingExercise, NotificationTargetFactory.EXERCISE_UPDATED_TEXT)); } @@ -233,6 +240,12 @@ public static String[] createPlaceholderExerciseNotification(String courseTitle, return new String[] { courseTitle, exerciseTitle }; } + @NotificationPlaceholderCreator(values = { EXERCISE_RELEASED, EXERCISE_PRACTICE, QUIZ_EXERCISE_STARTED, EXERCISE_UPDATED, PROGRAMMING_TEST_CASES_CHANGED, + PROGRAMMING_EXAM_TEST_CASES_CHANGED, NEW_MANUAL_FEEDBACK_REQUEST, DUPLICATE_TEST_CASE, PROGRAMMING_REPOSITORY_LOCKS, PROGRAMMING_BUILD_RUN_UPDATE, ILLEGAL_SUBMISSION }) + public static String[] createPlaceholderExamExerciseNotification(String examTitle, String exerciseTitle) { + return new String[] { examTitle, exerciseTitle }; + } + /** * Creates an instance of GroupNotification based on the passed parameters. * diff --git a/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java b/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java index 967cd0d70115..711763e60273 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/notifications/GroupNotificationService.java @@ -14,6 +14,7 @@ import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.NEW_ANNOUNCEMENT_POST; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.NEW_MANUAL_FEEDBACK_REQUEST; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_BUILD_RUN_UPDATE; +import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_EXAM_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_REPOSITORY_LOCKS; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.QUIZ_EXERCISE_STARTED; @@ -137,10 +138,10 @@ private void notifyGroupsWithNotificationType(GroupNotificationType[] groups, No case EXAM_ARCHIVE_STARTED, EXAM_ARCHIVE_FINISHED, EXAM_ARCHIVE_FAILED -> createNotification((Exam) notificationSubject, author, group, notificationType, (List) typeSpecificInformation); // Critical Types - case DUPLICATE_TEST_CASE, ILLEGAL_SUBMISSION, PROGRAMMING_REPOSITORY_LOCKS, PROGRAMMING_BUILD_RUN_UPDATE -> + case DUPLICATE_TEST_CASE, ILLEGAL_SUBMISSION, PROGRAMMING_REPOSITORY_LOCKS, PROGRAMMING_BUILD_RUN_UPDATE, PROGRAMMING_EXAM_TEST_CASES_CHANGED -> createNotification((Exercise) notificationSubject, author, group, notificationType, (String) typeSpecificInformation); // Additional Types - case PROGRAMMING_TEST_CASES_CHANGED, PROGRAMMING_EXAM_TEST_CASES_CHANGED, NEW_MANUAL_FEEDBACK_REQUEST -> + case PROGRAMMING_TEST_CASES_CHANGED, NEW_MANUAL_FEEDBACK_REQUEST -> createNotification((Exercise) notificationSubject, author, group, notificationType, (String) typeSpecificInformation); default -> throw new UnsupportedOperationException("Unsupported NotificationType: " + notificationType); }; @@ -226,6 +227,15 @@ public void notifyEditorAndInstructorGroupsAboutChangedTestCasesForProgrammingEx notifyGroupsWithNotificationType(new GroupNotificationType[] { EDITOR, INSTRUCTOR }, PROGRAMMING_TEST_CASES_CHANGED, exercise, null, null); } + /** + * Notify editor and instructor groups about changed test cases for an exam programming exercise. + * + * @param exercise that has been updated + */ + public void notifyEditorInstructorGroupsAboutChangedTestCasesForExamProgrammingExercise(ProgrammingExercise exercise) { + notifyGroupsWithNotificationType(new GroupNotificationType[] { EDITOR, INSTRUCTOR }, PROGRAMMING_EXAM_TEST_CASES_CHANGED, exercise, null, null); + } + /** * Notify editor and instructor groups about a finished repository permission change and the amount of failed updated. * From 93b53c13c196d0b144ed00e07221083b7418ad39 Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Wed, 21 Aug 2024 22:28:47 +0200 Subject: [PATCH 05/13] change notification-popup.component.ts --- .../notification-popup/notification-popup.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/webapp/app/shared/notification/notification-popup/notification-popup.component.ts b/src/main/webapp/app/shared/notification/notification-popup/notification-popup.component.ts index b1f5f7d184bb..fa115e06eeeb 100644 --- a/src/main/webapp/app/shared/notification/notification-popup/notification-popup.component.ts +++ b/src/main/webapp/app/shared/notification/notification-popup/notification-popup.component.ts @@ -15,6 +15,7 @@ import { NEW_REPLY_FOR_LECTURE_POST_TITLE, NEW_REPLY_MESSAGE_TITLE, Notification, + PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE, QUIZ_EXERCISE_STARTED_TITLE, } from 'app/entities/notification.model'; import { GroupNotification } from 'app/entities/group-notification.model'; @@ -38,6 +39,7 @@ const conversationMessageNotificationTitles = [ NEW_REPLY_FOR_LECTURE_POST_TITLE, NEW_REPLY_FOR_EXAM_POST_TITLE, NEW_REPLY_FOR_COURSE_POST_TITLE, + PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE, ]; @Component({ From 3b359859a6048a0f19261f743d25be574a923e7d Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Wed, 21 Aug 2024 22:29:10 +0200 Subject: [PATCH 06/13] add case for the exam programming exercise in the messaging service --- .../service/programming/ProgrammingMessagingService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingMessagingService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingMessagingService.java index d6b6835f6aee..40692a71103a 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingMessagingService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingMessagingService.java @@ -126,7 +126,12 @@ public void notifyUserAboutTestCaseChanged(boolean testCasesChanged, Programming websocketMessagingService.sendMessage(getProgrammingExerciseTestCaseChangedTopic(updatedProgrammingExercise.getId()), testCasesChanged); // Send a notification to the client to inform the instructor about the test case update. if (testCasesChanged) { - groupNotificationService.notifyEditorAndInstructorGroupsAboutChangedTestCasesForProgrammingExercise(updatedProgrammingExercise); + if (updatedProgrammingExercise.isExamExercise()) { + groupNotificationService.notifyEditorInstructorGroupsAboutChangedTestCasesForExamProgrammingExercise(updatedProgrammingExercise); + } + else { + groupNotificationService.notifyEditorAndInstructorGroupsAboutChangedTestCasesForProgrammingExercise(updatedProgrammingExercise); + } } else { groupNotificationService.notifyEditorAndInstructorGroupAboutExerciseUpdate(updatedProgrammingExercise, TEST_CASES_CHANGED_RUN_COMPLETED_NOTIFICATION); From f313bd7fe5b46c2c2ebb5e0d5b23481beccf4d23 Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Thu, 22 Aug 2024 00:41:07 +0200 Subject: [PATCH 07/13] add notification settings --- .../webapp/app/shared/constants/user-settings.constants.ts | 1 + .../notification-settings/notification-settings-structure.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/main/webapp/app/shared/constants/user-settings.constants.ts b/src/main/webapp/app/shared/constants/user-settings.constants.ts index be78a5292b80..7a85bb6e6e2b 100644 --- a/src/main/webapp/app/shared/constants/user-settings.constants.ts +++ b/src/main/webapp/app/shared/constants/user-settings.constants.ts @@ -44,6 +44,7 @@ export enum SettingId { // editor notification setting group NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_TEST_CASES_CHANGED = 'notification.editor-notification.programming-test-cases-changed', + NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_EXAM_TEST_CASES_CHANGED = 'notification.editor-notification.programming-exam-test-cases-changed', // instructor notification setting group NOTIFICATION__INSTRUCTOR_NOTIFICATION__COURSE_AND_EXAM_ARCHIVING_STARTED = 'notification.instructor-notification.course-and-exam-archiving-started', diff --git a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts index 8f3da86abbe8..1bb164d338ae 100644 --- a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts +++ b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts @@ -207,6 +207,11 @@ export const notificationSettingsStructure: UserSettingsStructure Date: Thu, 22 Aug 2024 13:02:57 +0200 Subject: [PATCH 08/13] add user settings translations --- src/main/webapp/i18n/de/userSettings.json | 2 ++ src/main/webapp/i18n/en/userSettings.json | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/webapp/i18n/de/userSettings.json b/src/main/webapp/i18n/de/userSettings.json index 4898166be418..e13e0bc6c8f9 100644 --- a/src/main/webapp/i18n/de/userSettings.json +++ b/src/main/webapp/i18n/de/userSettings.json @@ -73,6 +73,7 @@ "courseAndExamArchivingStarted": "Kurs und Klausur Archivierungsstart", "fileSubmissionSuccessful": "Erfolgreiche Einreichung von Dateiupload-Aufgaben", "programmingTestCasesChanged": "Veränderte Testfälle bei Programmieraufgaben", + "programmingExamTestCasesChanged": "Veränderte Testfälle bei Klausurprogrammieraufgaben", "registrationTutorialGroup": "An- und Abmeldungen von Übungsgruppen", "tutorialGroupUpdateDelete": "Änderungen und Löschungen von Übungsgruppen", "newConversationMessages": "Neue Nachrichten in Unterhaltung", @@ -99,6 +100,7 @@ "courseAndExamArchivingStartedDescription": "Erhalte eine Mitteilung, wenn das Archivieren eines Kurses oder einer Klausur angefangen hat", "fileSubmissionSuccessfulDescription": "Erhalte eine Mitteilung nach dem erfolgreichen Einreichen von Dateiupload-Aufgaben", "programmingTestCasesChangedDescription": "Erhalte eine Mitteilung bei Änderungen von Testfällen in Programmieraufgaben", + "programmingExamTestCasesChangedDescription": "Erhalte eine Mitteilung bei Änderungen von Testfällen in Klausurprogrammieraufgaben", "registrationTutorialGroupTutorDescription": "Erhalte eine Mitteilung, wenn ein:e Student:in für deine Übungsgruppe registriert oder abgemeldet wurde", "registrationTutorialGroupStudentDescription": "Erhalte eine Mitteilung, wenn du für eine Übungsgruppe registriert oder abgemeldet wurdest", "tutorialGroupUpdateDeleteDescription": "Erhalte eine Mitteilung, wenn eine Übungsgruppe aktualisiert oder gelöscht wurde in der du registriert oder Tutor:in bist", diff --git a/src/main/webapp/i18n/en/userSettings.json b/src/main/webapp/i18n/en/userSettings.json index 839dd249b260..32eca4b72ab5 100644 --- a/src/main/webapp/i18n/en/userSettings.json +++ b/src/main/webapp/i18n/en/userSettings.json @@ -73,6 +73,7 @@ "courseAndExamArchivingStarted": "Course & Exam Archiving Started", "fileSubmissionSuccessful": "File Submission Successful", "programmingTestCasesChanged": "Changed Test Cases for Programming Exercises", + "programmingExamTestCasesChanged": "Changed Test Cases for Exam Programming Exercises", "registrationTutorialGroup": "Registration and Deregistration for Tutorial Group", "newConversationMessages": "New messages in conversations", "newReplyMessage": "New replies in conversations", @@ -99,6 +100,7 @@ "courseAndExamArchivingStartedDescription": "Receive a notification when the process of archiving a course or exam has been started", "fileSubmissionSuccessfulDescription": "Receive a notification after you successfully submitted a file upload exercise", "programmingTestCasesChangedDescription": "Get notified if test cases for a programming exercises have been changed", + "programmingExamTestCasesChangedDescription": "Get notified if test cases for an exam programming exercises have been changed", "registrationTutorialGroupTutorDescription": "Get notified when a student was registered or deregistered from your tutorial group", "registrationTutorialGroupStudentDescription": "Get notified when you were registered or deregistered from a tutorial group", "newConversationMessageDescription": "Get notified when you receive a new message in a conversation", From 500257be9a1e31f8ea1c14e912f5700b506f177f Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Thu, 22 Aug 2024 13:03:15 +0200 Subject: [PATCH 09/13] add new setting in NotificationSettingsService --- .../service/notifications/NotificationSettingsService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java b/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java index 321b643b7892..2036010745b3 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java @@ -121,6 +121,8 @@ public class NotificationSettingsService { // editor notification setting group public static final String NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_TEST_CASES_CHANGED = "notification.editor-notification.programming-test-cases-changed"; + public static final String NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_EXAM_TEST_CASES_CHANGED = "notification.editor-notification.programming-exam-test-cases-changed"; + // instructor notification setting group public static final String NOTIFICATION__INSTRUCTOR_NOTIFICATION__COURSE_AND_EXAM_ARCHIVING_STARTED = "notification.instructor-notification.course-and-exam-archiving-started"; @@ -166,6 +168,7 @@ public class NotificationSettingsService { new NotificationSetting(true, false, true, NOTIFICATION__TUTOR_NOTIFICATION__TUTORIAL_GROUP_REGISTRATION), // editor notification setting group new NotificationSetting(true, false, true, NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_TEST_CASES_CHANGED), + new NotificationSetting(true, false, true, NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_EXAM_TEST_CASES_CHANGED), // instructor notification setting group new NotificationSetting(true, false, true, NOTIFICATION__INSTRUCTOR_NOTIFICATION__COURSE_AND_EXAM_ARCHIVING_STARTED), new NotificationSetting(true, false, true, NOTIFICATION__TUTOR_NOTIFICATION__TUTORIAL_GROUP_ASSIGN_UNASSIGN), From 45919ac0f5155516ffe84001cbb9fe28b8976101 Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Thu, 22 Aug 2024 13:04:21 +0200 Subject: [PATCH 10/13] add title to notification.model.ts --- src/main/webapp/app/entities/notification.model.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/app/entities/notification.model.ts b/src/main/webapp/app/entities/notification.model.ts index 4daae3609adc..dd557fb0f2a1 100644 --- a/src/main/webapp/app/entities/notification.model.ts +++ b/src/main/webapp/app/entities/notification.model.ts @@ -79,7 +79,7 @@ export const EXAM_ARCHIVE_FAILED_TITLE = 'artemisApp.groupNotification.title.exa export const PROGRAMMING_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingTestCasesChanged'; -export const PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingTestCasesChanged'; +export const PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE = 'artemisApp.groupNotification.title.programmingExamTestCasesChanged'; export const NEW_MANUAL_FEEDBACK_REQUEST_TITLE = 'artemisApp.groupNotification.title.newManualFeedbackRequest'; From 942cc518b028ab0472503b1bd108e46b906cf00a Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Thu, 22 Aug 2024 13:08:33 +0200 Subject: [PATCH 11/13] style --- .../in/www1/artemis/domain/enumeration/NotificationType.java | 1 - .../www1/artemis/domain/notification/NotificationConstants.java | 1 - .../service/notifications/NotificationSettingsService.java | 1 - .../notification-settings/notification-settings-structure.ts | 2 +- .../notification-settings/notification-settings.service.ts | 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java b/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java index fb65f33a8724..2a5c4fafe846 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/enumeration/NotificationType.java @@ -1,6 +1,5 @@ package de.tum.in.www1.artemis.domain.enumeration; -// TODO Michal Kawka public enum NotificationType { EXERCISE_SUBMISSION_ASSESSED, ATTACHMENT_CHANGE, EXERCISE_RELEASED, EXERCISE_PRACTICE, QUIZ_EXERCISE_STARTED, EXERCISE_UPDATED, NEW_REPLY_FOR_EXERCISE_POST, NEW_REPLY_FOR_LECTURE_POST, NEW_REPLY_FOR_COURSE_POST, NEW_REPLY_FOR_EXAM_POST, NEW_EXERCISE_POST, NEW_LECTURE_POST, NEW_COURSE_POST, NEW_ANNOUNCEMENT_POST, NEW_EXAM_POST, diff --git a/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java b/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java index 38fe7e56b629..3b070936da2b 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationConstants.java @@ -59,7 +59,6 @@ import de.tum.in.www1.artemis.domain.enumeration.NotificationType; -// TODO Michal Kawka public class NotificationConstants { // Titles diff --git a/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java b/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java index 2036010745b3..75f1f64be5ff 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/notifications/NotificationSettingsService.java @@ -64,7 +64,6 @@ @Profile(PROFILE_CORE) @Service -// TODO Michal Kawka public class NotificationSettingsService { private final NotificationSettingRepository notificationSettingRepository; diff --git a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts index 1bb164d338ae..716dbea9b5e3 100644 --- a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts +++ b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings-structure.ts @@ -14,7 +14,7 @@ export interface NotificationSetting extends Setting { // If left undefined emailSupport will count as false/deactivated emailSupport?: boolean; } -//TODO Michal Kawka + export const notificationSettingsStructure: UserSettingsStructure = { category: UserSettingsCategory.NOTIFICATION_SETTINGS, groups: [ diff --git a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts index e92a28ee648e..a2f5300a1bd9 100644 --- a/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts +++ b/src/main/webapp/app/shared/user-settings/notification-settings/notification-settings.service.ts @@ -46,7 +46,6 @@ import { Observable, ReplaySubject } from 'rxjs'; export const reloadNotificationSideBarMessage = 'reloadNotificationsInNotificationSideBar'; -//TODO Michal Kawka @Injectable({ providedIn: 'root' }) export class NotificationSettingsService { /** From eaf1b0e48c5b0dbeffc2b9135a815e089b71b649 Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Thu, 22 Aug 2024 13:09:38 +0200 Subject: [PATCH 12/13] comment in code --- .../service/programming/ProgrammingTriggerService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java index 38732fb61ab8..1c981569ea0c 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingTriggerService.java @@ -149,9 +149,9 @@ private void setTestCasesChanged(ProgrammingExercise programmingExercise, boolea boolean resultsExist = resultRepository.existsByParticipation_ExerciseId(programmingExercise.getId()); - // if (testCasesChanged == programmingExercise.getTestCasesChanged() || (!resultsExist && testCasesChanged)) { - // return; - // } + if (testCasesChanged == programmingExercise.getTestCasesChanged() || (!resultsExist && testCasesChanged)) { + return; + } programmingExercise.setTestCasesChanged(testCasesChanged); ProgrammingExercise updatedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); From 5e48877cb983acc20ee5fc6164a02d317f45efde Mon Sep 17 00:00:00 2001 From: Michal Kawka Date: Thu, 22 Aug 2024 23:04:46 +0200 Subject: [PATCH 13/13] add tests --- .../notification/GroupNotificationFactoryTest.java | 13 +++++++++++++ .../notification/GroupNotificationServiceTest.java | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java b/src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java index 3748f390206b..1387b0bd6546 100644 --- a/src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java +++ b/src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java @@ -15,6 +15,7 @@ import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.EXERCISE_RELEASED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.EXERCISE_UPDATED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.NEW_ANNOUNCEMENT_POST; +import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_EXAM_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.PROGRAMMING_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.domain.enumeration.NotificationType.QUIZ_EXERCISE_STARTED; import static de.tum.in.www1.artemis.domain.notification.GroupNotificationFactory.createAnnouncementNotification; @@ -42,6 +43,8 @@ import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.LIVE_EXAM_EXERCISE_UPDATE_NOTIFICATION_TITLE; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.NEW_ANNOUNCEMENT_POST_TEXT; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.NEW_ANNOUNCEMENT_POST_TITLE; +import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.PROGRAMMING_EXAM_TEST_CASES_CHANGED_TEXT; +import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TEXT; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TITLE; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.QUIZ_EXERCISE_STARTED_TEXT; @@ -356,6 +359,16 @@ void createNotificationBasedOnExercise_withNotificationType_ProgrammingTestCases createAndCheckNotification(Base.EXERCISE); } + @Test + void createNotificationBasedOnExercise_withNotificationType_ProgrammingExamTestCasesChanged() { + notificationType = PROGRAMMING_EXAM_TEST_CASES_CHANGED; + expectedTitle = PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE; + expectedText = PROGRAMMING_EXAM_TEST_CASES_CHANGED_TEXT; + expectedTransientTarget = createExerciseTarget(exercise, EXERCISE_UPDATED_TEXT); + expectedPriority = HIGH; + createAndCheckNotification(Base.EXERCISE); + } + /** * Tests the functionality that deals with notifications that have the notification type of EXERCISE_UPDATED and are part of an exam. * I.e. notifications that originate from an updated exam exercise. diff --git a/src/test/java/de/tum/in/www1/artemis/notification/GroupNotificationServiceTest.java b/src/test/java/de/tum/in/www1/artemis/notification/GroupNotificationServiceTest.java index d8e48ec2611c..e14dd59e3788 100644 --- a/src/test/java/de/tum/in/www1/artemis/notification/GroupNotificationServiceTest.java +++ b/src/test/java/de/tum/in/www1/artemis/notification/GroupNotificationServiceTest.java @@ -18,8 +18,10 @@ import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.EXERCISE_RELEASED_TITLE; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.EXERCISE_UPDATED_TITLE; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.ILLEGAL_SUBMISSION_TITLE; +import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.PROGRAMMING_TEST_CASES_CHANGED_TITLE; import static de.tum.in.www1.artemis.domain.notification.NotificationConstants.QUIZ_EXERCISE_STARTED_TITLE; +import static de.tum.in.www1.artemis.service.notifications.NotificationSettingsService.NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_EXAM_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.service.notifications.NotificationSettingsService.NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_TEST_CASES_CHANGED; import static de.tum.in.www1.artemis.service.notifications.NotificationSettingsService.NOTIFICATION__EXERCISE_NOTIFICATION__EXERCISE_OPEN_FOR_PRACTICE; import static de.tum.in.www1.artemis.service.notifications.NotificationSettingsService.NOTIFICATION__EXERCISE_NOTIFICATION__EXERCISE_RELEASED; @@ -529,6 +531,16 @@ void testNotifyInstructorGroupAboutChangedTestCasesForProgrammingExercise() { verifyRepositoryCallWithCorrectNotificationAndReturnNotification(2, PROGRAMMING_TEST_CASES_CHANGED_TITLE); } + /** + * Test for notifyInstructorGroupAboutChangedTestCasesForExamProgrammingExercise method + */ + @Test + void testNotifyInstructorGroupAboutChangedTestCasesForExamProgrammingExercise() { + prepareNotificationSettingForTest(instructor, NOTIFICATION__EDITOR_NOTIFICATION__PROGRAMMING_EXAM_TEST_CASES_CHANGED); + groupNotificationService.notifyEditorInstructorGroupsAboutChangedTestCasesForExamProgrammingExercise(programmingExercise); + verifyRepositoryCallWithCorrectNotificationAndReturnNotification(2, PROGRAMMING_EXAM_TEST_CASES_CHANGED_TITLE); + } + // Course Archiving /**