Skip to content

Commit

Permalink
Development: Improve server code quality in assessment module
Browse files Browse the repository at this point in the history
  • Loading branch information
krusche committed Sep 28, 2024
1 parent f1409dc commit c1c33cd
Show file tree
Hide file tree
Showing 45 changed files with 284 additions and 350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record MaxAndReachablePoints(double maxPoints, double reachablePoints, double reachablePresentationPoints) {
public record MaxAndReachablePointsDTO(double maxPoints, double reachablePoints, double reachablePresentationPoints) {

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package de.tum.cit.aet.artemis.assessment.dto;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record ScoreDistributionDTO(long amount, double score) {

public ScoreDistributionDTO(Long amount, Double score) {
this(amount != null ? amount : 0, score != null ? score : 0.0);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package de.tum.cit.aet.artemis.assessment.dto;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
* A data entry used by the tutor effort statistics page. It represents the respective information in terms of
* number of submissions assessed as well as time spent for each tutor in a particular exercise.
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TutorEffortDTO(Long userId, int numberOfSubmissionsAssessed, double totalTimeSpentMinutes, Long exerciseId, Long courseId) {
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.tum.cit.aet.artemis.assessment.dto.dashboard;

import com.fasterxml.jackson.annotation.JsonInclude;

// Custom object for sql query
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record ExerciseMapEntryDTO(long exerciseId, long value) {

public ExerciseMapEntryDTO(Long exerciseId, Long value) {
this(exerciseId != null ? exerciseId : 0, value != null ? value : 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
* Class used to hold tutor average rating and number of tutor ratings in an exercise
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record ExerciseRatingCount(Double averageRating, Long numberOfRatings) {
public record ExerciseRatingCountDTO(Double averageRating, Long numberOfRatings) {

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package de.tum.cit.aet.artemis.assessment.dto.dashboard;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record ResultCountDTO(boolean rated, long count) {

public ResultCountDTO(Boolean rated, Long count) {
this(rated != null ? rated : false, count != null ? count : 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
* @param sumPointsAchieved the sum of points achieved by the student
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record StudentScoreSum(long userId, double sumPointsAchieved) {
public record StudentScoreSumDTO(long userId, double sumPointsAchieved) {

public StudentScoreSumDTO(Long userId, Double sumPointsAchieved) {
this(userId != null ? userId : 0, sumPointsAchieved != null ? sumPointsAchieved : 0.0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
* @param sumPointsAchieved the sum of points achieved by the team
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TeamScoreSum(long teamId, double sumPointsAchieved) {
public record TeamScoreSumDTO(long teamId, double sumPointsAchieved) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import com.fasterxml.jackson.annotation.JsonInclude;

// Custom object for sql query
// Custom object for sql query, we cannot use primitive types here, because otherwise Hibernate gets confused
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TutorLeaderboardAnsweredMoreFeedbackRequests(Long userId, Long answeredRequests, Double points) {
public record TutorLeaderboardAnsweredMoreFeedbackRequestsDTO(Long userId, Long answeredRequests, Double points) {

public TutorLeaderboardAnsweredMoreFeedbackRequests() {
public TutorLeaderboardAnsweredMoreFeedbackRequestsDTO() {
this(0L, 0L, 0.0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import com.fasterxml.jackson.annotation.JsonInclude;

// Custom object for sql query
// Custom object for sql query, we cannot use primitive types here, because otherwise Hibernate gets confused
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TutorLeaderboardAssessments(Long userId, Long assessments, Double points, Double averageScore, Double averageRating, Long numberOfRatings) {
public record TutorLeaderboardAssessmentsDTO(Long userId, Long assessments, Double points, Double averageScore, Double averageRating, Long numberOfRatings) {

public TutorLeaderboardAssessments() {
public TutorLeaderboardAssessmentsDTO() {
this(0L, 0L, 0.0, 0.0, 0.0, 0L);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import com.fasterxml.jackson.annotation.JsonInclude;

// Custom object for sql query
// Custom object for sql query, we cannot use primitive types here, because otherwise Hibernate gets confused
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TutorLeaderboardComplaintResponses(Long userId, Long complaintResponses, Double points) {
public record TutorLeaderboardComplaintResponsesDTO(Long userId, Long complaintResponses, Double points) {

public TutorLeaderboardComplaintResponses() {
public TutorLeaderboardComplaintResponsesDTO() {
this(0L, 0L, 0.0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import com.fasterxml.jackson.annotation.JsonInclude;

// Custom object for sql query
// Custom object for sql query, we cannot use primitive types here, because otherwise Hibernate gets confused
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TutorLeaderboardComplaints(Long userId, Long allComplaints, Long acceptedComplaints, Double points) {
public record TutorLeaderboardComplaintsDTO(Long userId, Long allComplaints, Long acceptedComplaints, Double points) {

public TutorLeaderboardComplaints() {
public TutorLeaderboardComplaintsDTO() {
this(0L, 0L, 0L, 0.0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import com.fasterxml.jackson.annotation.JsonInclude;

// Custom object for sql query
// Custom object for sql query, we cannot use primitive types here, because otherwise Hibernate gets confused
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TutorLeaderboardMoreFeedbackRequests(Long userId, Long allRequests, Long notAnsweredRequests, Double points) {
public record TutorLeaderboardMoreFeedbackRequestsDTO(Long userId, Long allRequests, Long notAnsweredRequests, Double points) {

public TutorLeaderboardMoreFeedbackRequests() {
public TutorLeaderboardMoreFeedbackRequestsDTO() {
this(0L, 0L, 0L, 0.0);
}

Expand Down
Loading

0 comments on commit c1c33cd

Please sign in to comment.