Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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

COURSE_CHANGED("course-changed"),

CHAPTER_CHANGED("chapter-changed"),

CONTENT_PROGRESSED("content-progressed"),
Expand Down Expand Up @@ -45,7 +46,15 @@ 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"),

REQUEST_HEXAD_PLAYER_TYPE("request-hexad-player-type"),

REQUEST_USER_SKILL_LEVEL("request-user-skill-level"),

STUDENT_CODE_SUBMITTED("student-code-submitted"),;

private final String topic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,40 @@ 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 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 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 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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<String, String> files;

/**
* Name of the branch from which the code was submitted.
*/
private String branch;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public enum TutorCategory {
LECTURE,
UNRECOGNIZABLE,
OTHER,
ERROR
ERROR,
CODE_FEEDBACK
}
Original file line number Diff line number Diff line change
@@ -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<HexadPlayerType, Double> playerTypePercentages;
}
Loading