From de059657b4c45c8605b231d91a20912416a96043 Mon Sep 17 00:00:00 2001 From: mp-dg <57503145+MP-DG@users.noreply.github.com> Date: Wed, 26 Nov 2025 22:45:43 +0100 Subject: [PATCH 1/5] added event to send HexadPlayerType --- .../iste/meitrex/common/dapr/DaprTopic.java | 4 +- .../meitrex/common/dapr/TopicPublisher.java | 8 ++++ .../meitrex/common/event/HexadPlayerType.java | 13 +++++++ .../event/UserHexadPlayerTypeSetEvent.java | 39 +++++++++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/unistuttgart/iste/meitrex/common/event/HexadPlayerType.java create mode 100644 src/main/java/de/unistuttgart/iste/meitrex/common/event/UserHexadPlayerTypeSetEvent.java diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java index 3a7f3ef..341c05b 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java @@ -45,7 +45,9 @@ public enum DaprTopic { ASKED_TUTOR_A_QUESTION("asked-tutor-a-question"), - SUBMISSION_COMPLETED("submission-completed"),; + SUBMISSION_COMPLETED("submission-completed"), + + USER_HEXAD_PLAYER_TYPE_SET("user-hexad-player-type-set"),; private final String topic; diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java index 9ecf441..71ff1b2 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java @@ -197,6 +197,14 @@ public void notifySubmissionCompleted(final SubmissionCompletedEvent event) { publishEvent(event, DaprTopic.SUBMISSION_COMPLETED); } + /** + * Method to notify when a user's Hexad player type is set, updated or requested for the first time + * @param event of the user's Hexad player type that was set + */ + public void notifyUserHexadPlayerTypeSet(final UserHexadPlayerTypeSetEvent event) { + publishEvent(event, DaprTopic.USER_HEXAD_PLAYER_TYPE_SET); + } + /** * Method to notify when a notification is build and should be sent to Notification Service * @param courseId of changed course diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/event/HexadPlayerType.java b/src/main/java/de/unistuttgart/iste/meitrex/common/event/HexadPlayerType.java new file mode 100644 index 0000000..8968108 --- /dev/null +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/event/HexadPlayerType.java @@ -0,0 +1,13 @@ +package de.unistuttgart.iste.meitrex.common.event; + +/** + * Enum representing the Hexad player types used in gamification. + */ +public enum HexadPlayerType { + ACHIEVER, + PLAYER, + SOCIALISER, + FREE_SPIRIT, + PHILANTHROPIST, + DISRUPTOR +} diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/event/UserHexadPlayerTypeSetEvent.java b/src/main/java/de/unistuttgart/iste/meitrex/common/event/UserHexadPlayerTypeSetEvent.java new file mode 100644 index 0000000..08effbf --- /dev/null +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/event/UserHexadPlayerTypeSetEvent.java @@ -0,0 +1,39 @@ +package de.unistuttgart.iste.meitrex.common.event; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Map; +import java.util.UUID; + +import jakarta.validation.constraints.NotNull; + +/** + * Event sent by the gamification service when a user's Hexad player type is set or updated. + * Additionally send if the user's player type is requested for the first time + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class UserHexadPlayerTypeSetEvent { + /** + * The ID of the user whose Hexad player type was set. + */ + @NotNull + private UUID userId; + + /** + * The primary Hexad player type that was set for the user. + */ + @NotNull + private HexadPlayerType primaryPlayerType; + + /** + * Maps each HexadPlayerType to its score. + */ + @NotNull + private Map playerTypePercentages; +} From 4957c5fe436962cc98eb25f270dab374fc16fe43 Mon Sep 17 00:00:00 2001 From: mp-dg <57503145+MP-DG@users.noreply.github.com> Date: Thu, 27 Nov 2025 02:28:19 +0100 Subject: [PATCH 2/5] added RequestHexadPlayerTypeEvent to request a UserHexadPlayerTypeSetEvent --- .../iste/meitrex/common/dapr/DaprTopic.java | 5 +++- .../meitrex/common/dapr/TopicPublisher.java | 8 ++++++ .../event/RequestHexadPlayerTypeEvent.java | 25 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestHexadPlayerTypeEvent.java diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java index 341c05b..9b67347 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java @@ -3,6 +3,7 @@ public enum DaprTopic { COURSE_CHANGED("course-changed"), + CHAPTER_CHANGED("chapter-changed"), CONTENT_PROGRESSED("content-progressed"), @@ -47,7 +48,9 @@ public enum DaprTopic { SUBMISSION_COMPLETED("submission-completed"), - USER_HEXAD_PLAYER_TYPE_SET("user-hexad-player-type-set"),; + USER_HEXAD_PLAYER_TYPE_SET("user-hexad-player-type-set"), + + REQUEST_HEXAD_PLAYER_TYPE("request-hexad-player-type"),; private final String topic; diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java index 71ff1b2..242d6ff 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java @@ -205,6 +205,14 @@ public void notifyUserHexadPlayerTypeSet(final UserHexadPlayerTypeSetEvent event publishEvent(event, DaprTopic.USER_HEXAD_PLAYER_TYPE_SET); } + /** + * Method to request a UserHexadPlayerTypeSetEvent for a specific user + * @param event containing the user ID for which the player type is requested + */ + public void notifyRequestHexadPlayerType(final RequestHexadPlayerTypeEvent event) { + publishEvent(event, DaprTopic.REQUEST_HEXAD_PLAYER_TYPE); + } + /** * Method to notify when a notification is build and should be sent to Notification Service * @param courseId of changed course diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestHexadPlayerTypeEvent.java b/src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestHexadPlayerTypeEvent.java new file mode 100644 index 0000000..4a7955a --- /dev/null +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestHexadPlayerTypeEvent.java @@ -0,0 +1,25 @@ +package de.unistuttgart.iste.meitrex.common.event; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.UUID; + +import jakarta.validation.constraints.NotNull; + +/** + * Event to request the Hexad player type for a specific user. + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class RequestHexadPlayerTypeEvent { + /** + * The ID of the user whose Hexad player type is being requested. + */ + @NotNull + private UUID userId; +} From aab5754a1eeb176fc7cae726d594666721d23641 Mon Sep 17 00:00:00 2001 From: mp-dg <57503145+MP-DG@users.noreply.github.com> Date: Fri, 28 Nov 2025 19:45:38 +0100 Subject: [PATCH 3/5] added RequestUserSkillLevelEvent --- .../iste/meitrex/common/dapr/DaprTopic.java | 4 ++- .../meitrex/common/dapr/TopicPublisher.java | 8 ++++++ .../event/RequestUserSkillLevelEvent.java | 25 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestUserSkillLevelEvent.java diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java index 9b67347..3f50803 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java @@ -50,7 +50,9 @@ public enum DaprTopic { USER_HEXAD_PLAYER_TYPE_SET("user-hexad-player-type-set"), - REQUEST_HEXAD_PLAYER_TYPE("request-hexad-player-type"),; + REQUEST_HEXAD_PLAYER_TYPE("request-hexad-player-type"), + + REQUEST_USER_SKILL_LEVEL("request-user-skill-level"),; private final String topic; diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java index 242d6ff..8fce0e2 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java @@ -213,6 +213,14 @@ public void notifyRequestHexadPlayerType(final RequestHexadPlayerTypeEvent event publishEvent(event, DaprTopic.REQUEST_HEXAD_PLAYER_TYPE); } + /** + * Method to request the skill levels for a specific user + * @param event containing the user ID for which the skill levels are requested + */ + public void notifyRequestUserSkillLevel(final RequestUserSkillLevelEvent event) { + publishEvent(event, DaprTopic.REQUEST_USER_SKILL_LEVEL); + } + /** * Method to notify when a notification is build and should be sent to Notification Service * @param courseId of changed course diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestUserSkillLevelEvent.java b/src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestUserSkillLevelEvent.java new file mode 100644 index 0000000..c02ff1b --- /dev/null +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/event/RequestUserSkillLevelEvent.java @@ -0,0 +1,25 @@ +package de.unistuttgart.iste.meitrex.common.event; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.UUID; + +import jakarta.validation.constraints.NotNull; + +/** + * Event to request the skill levels for a specific user. + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class RequestUserSkillLevelEvent { + /** + * The ID of the user whose skill levels are being requested. + */ + @NotNull + private UUID userId; +} From aa80f83b7feb8ef29629b8feabe565f22ec76907 Mon Sep 17 00:00:00 2001 From: mp-dg <57503145+MP-DG@users.noreply.github.com> Date: Mon, 15 Dec 2025 10:04:27 +0100 Subject: [PATCH 4/5] added event to pass students code from assignment_service to other services --- .../iste/meitrex/common/dapr/DaprTopic.java | 4 +- .../meitrex/common/dapr/TopicPublisher.java | 10 +++ .../event/StudentCodeSubmittedEvent.java | 67 +++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/unistuttgart/iste/meitrex/common/event/StudentCodeSubmittedEvent.java diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java index 3f50803..30d0867 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/DaprTopic.java @@ -52,7 +52,9 @@ public enum DaprTopic { REQUEST_HEXAD_PLAYER_TYPE("request-hexad-player-type"), - REQUEST_USER_SKILL_LEVEL("request-user-skill-level"),; + REQUEST_USER_SKILL_LEVEL("request-user-skill-level"), + + STUDENT_CODE_SUBMITTED("student-code-submitted"),; private final String topic; diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java index 8fce0e2..5b26874 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/dapr/TopicPublisher.java @@ -221,6 +221,16 @@ public void notifyRequestUserSkillLevel(final RequestUserSkillLevelEvent event) publishEvent(event, DaprTopic.REQUEST_USER_SKILL_LEVEL); } + /** + * Method to notify when a student submits code for an assignment. + * This is triggered when the assignment service loads a student's code from their repository. + * + * @param event containing the submission details including student, assignment, repository info, and files + */ + public void notifyStudentCodeSubmitted(final StudentCodeSubmittedEvent event) { + publishEvent(event, DaprTopic.STUDENT_CODE_SUBMITTED); + } + /** * Method to notify when a notification is build and should be sent to Notification Service * @param courseId of changed course diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/event/StudentCodeSubmittedEvent.java b/src/main/java/de/unistuttgart/iste/meitrex/common/event/StudentCodeSubmittedEvent.java new file mode 100644 index 0000000..7ce34af --- /dev/null +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/event/StudentCodeSubmittedEvent.java @@ -0,0 +1,67 @@ +package de.unistuttgart.iste.meitrex.common.event; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** + * Event published when a student submits code for an assignment. + * + * This event is triggered by the assignment service when it loads and processes + * a student's code submission from their repository. The event contains information + * about the submission including the repository details, commit information, and + * the submitted files. + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StudentCodeSubmittedEvent { + + /** + * ID of the student who submitted the code. + */ + private UUID studentId; + + /** + * ID of the assignment for which the code was submitted. + */ + private UUID assignmentId; + + /** + * ID of the course the assignment belongs to. + */ + private UUID courseId; + + /** + * URL of the student's repository containing the submitted code. + */ + private String repositoryUrl; + + /** + * SHA hash of the commit that was submitted. + */ + private String commitSha; + + /** + * Timestamp when the commit was created. + */ + private OffsetDateTime commitTimestamp; + + /** + * Map of file paths to their contents from the submission. + * The key is the file path relative to the repository root, + * and the value is the file content. + */ + private Map files; + + /** + * Name of the branch from which the code was submitted. + */ + private String branch; +} From 5b150adfbc1e78e81898477f6f724c43273381ca Mon Sep 17 00:00:00 2001 From: mp-dg <57503145+MP-DG@users.noreply.github.com> Date: Mon, 15 Dec 2025 16:18:45 +0100 Subject: [PATCH 5/5] added CODE_FEEDBACK to TutorCategory --- .../unistuttgart/iste/meitrex/common/event/TutorCategory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/event/TutorCategory.java b/src/main/java/de/unistuttgart/iste/meitrex/common/event/TutorCategory.java index 40e08a0..38e783c 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/event/TutorCategory.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/event/TutorCategory.java @@ -5,5 +5,6 @@ public enum TutorCategory { LECTURE, UNRECOGNIZABLE, OTHER, - ERROR + ERROR, + CODE_FEEDBACK }