Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exam mode: Only send student notifications when end time has changed #7382

Merged
Show file tree
Hide file tree
Changes from 9 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
@@ -1,6 +1,6 @@
package de.tum.in.www1.artemis.repository;

import java.util.List;
import java.util.*;

Check warning on line 3 in src/main/java/de/tum/in/www1/artemis/repository/ExamLiveEventRepository.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/repository/ExamLiveEventRepository.java#L3

Star import of `java.util.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=7380-exam-mode-misleading-notification-when-updating-exam-details%3AHEAD&id=62C09B995F127D3FD5D439515C085063

import javax.transaction.Transactional;

Expand Down Expand Up @@ -32,6 +32,20 @@
""")
List<ExamLiveEvent> findAllByStudentExamIdOrGlobalByExamId(@Param("examId") Long examId, @Param("studentExamId") Long studentExamId);

/**
* Find all events for the given student exam in reverse creation order.
*
* @param studentExamId the id of the student exam
* @return a list of events
*/
@Query("""
SELECT event
FROM ExamLiveEvent event
WHERE event.studentExamId = :studentExamId
ORDER BY event.id DESC
""")
List<ExamLiveEvent> findAllByStudentExamId(@Param("studentExamId") Long studentExamId);

/**
* Delete all events for the given exam.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public ResponseEntity<Exam> updateExam(@PathVariable Long courseId, @RequestBody
}

// NOTE: if the end date was changed, we need to update student exams and re-schedule exercises
if (!originalExam.getEndDate().equals(savedExam.getEndDate())) {
if (comparator.compare(originalExam.getEndDate(), savedExam.getEndDate()) != 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this is the only change in this PR. The rest is adding & fixing tests

int workingTimeChange = savedExam.getDuration() - originalExamDuration;
updateStudentExamsAndRescheduleExercises(examWithExercises, originalExamDuration, workingTimeChange);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import static java.time.ZonedDateTime.now;

import java.time.ZonedDateTime;
import java.util.HashSet;
import java.util.Set;
import java.util.*;

Check warning on line 6 in src/test/java/de/tum/in/www1/artemis/exam/ExamFactory.java

View check run for this annotation

Teamscale / teamscale-findings

src/test/java/de/tum/in/www1/artemis/exam/ExamFactory.java#L6

Star import of `java.util.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=7380-exam-mode-misleading-notification-when-updating-exam-details%3AHEAD&id=B6A4CED3DC0A1D220834307F6B85B31E

import de.tum.in.www1.artemis.domain.Course;
import de.tum.in.www1.artemis.domain.exam.*;
Expand Down Expand Up @@ -136,7 +135,6 @@
*
* @param mandatory if the exercise group is mandatory
* @param exam the exam that this exercise group should be added to
*
* @return the newly created exercise
*/
public static ExerciseGroup generateExerciseGroup(boolean mandatory, Exam exam) {
Expand All @@ -149,7 +147,6 @@
* @param mandatory if the exercise group is mandatory
* @param exam the exam that this exercise group should be added to
* @param title title of the exercise group
*
* @return the newly created exercise
*/
public static ExerciseGroup generateExerciseGroupWithTitle(boolean mandatory, Exam exam, String title) {
Expand Down
Loading
Loading