Skip to content

Commit

Permalink
remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
BBesrour committed Nov 18, 2024
1 parent c9fcc6c commit 06b4e01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ public interface ProgrammingExerciseBuildConfigRepository extends ArtemisJpaRepo

Optional<ProgrammingExerciseBuildConfig> findByProgrammingExerciseId(Long programmingExerciseId);

default ProgrammingExerciseBuildConfig findByProgrammingExerciseIdElseThrow(Long programmingExerciseId) {
return getValueElseThrow(findByProgrammingExerciseId(programmingExerciseId), programmingExerciseId);
}

default ProgrammingExerciseBuildConfig getProgrammingExerciseBuildConfigElseThrow(ProgrammingExercise programmingExercise) {
if (programmingExercise.getBuildConfig() == null || !Hibernate.isInitialized(programmingExercise.getBuildConfig())) {
return getValueElseThrow(findByProgrammingExerciseId(programmingExercise.getId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,4 @@ default ProgrammingSubmission findByIdWithResultsFeedbacksAssessorTestCases(long
default ProgrammingSubmission findByResultIdElseThrow(long resultId) {
return getValueElseThrow(findByResultId(resultId));
}

@Query("""
SELECT s
FROM ProgrammingSubmission s
LEFT JOIN FETCH s.participation p
WHERE p.id = :participationId
AND s.commitHash = :commitHash
ORDER BY s.id DESC
""")
List<ProgrammingSubmission> findByParticipationIdAndCommitHashOrderByIdDesc(@Param("participationId") long participationId, @Param("commitHash") String commitHash);

default ProgrammingSubmission findFirstByParticipationIdAndCommitHashOrderByIdDesc(long participationId, String commitHash) {
return findByParticipationIdAndCommitHashOrderByIdDesc(participationId, commitHash).stream().findFirst().orElse(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,7 @@ public void notifyInstructorAboutCompletedExerciseBuildRun(ProgrammingExercise p
* @param exerciseId used to build the correct topic
*/
public void notifyUserAboutSubmission(ProgrammingSubmission submission, Long exerciseId) {
notifyUserAboutSubmission(submission, exerciseId, false);
}

/**
* Notify user on a new programming submission.
*
* @param submission ProgrammingSubmission
* @param exerciseId used to build the correct topic
* @param isProcessing whether the submission started processing or not
*/
public void notifyUserAboutSubmission(ProgrammingSubmission submission, Long exerciseId, boolean isProcessing) {
var submissionDTO = SubmissionDTO.of(submission, isProcessing, null, null);
var submissionDTO = SubmissionDTO.of(submission, false, null, null);
if (submission.getParticipation() instanceof StudentParticipation studentParticipation) {
if (studentParticipation.getParticipant() instanceof Team team) {
// eager load the team with students so their information can be used for the messages below
Expand Down Expand Up @@ -196,6 +185,15 @@ public void notifyUserAboutNewResult(Result result, ProgrammingExerciseParticipa
}
}

/**
* Notifies the user about the processing of a submission.
* This method sends a notification to the user that their submission is processing
* It handles both student participations and template/solution participations.
*
* @param submission the submission processing data transfer object containing the submission details
* @param exerciseId the ID of the exercise associated with the submission
* @param participationId the ID of the participation associated with the submission
*/
public void notifyUserAboutSubmissionProcessing(SubmissionProcessingDTO submission, long exerciseId, long participationId) {
Participation participation = participationRepository.findWithProgrammingExerciseWithBuildConfigById(participationId).orElseThrow();
if (participation instanceof StudentParticipation studentParticipation) {
Expand Down

0 comments on commit 06b4e01

Please sign in to comment.