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 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
@@ -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 @@ -7,18 +7,15 @@
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Map;
import java.util.Set;
import java.util.*;

Check warning on line 10 in src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCService.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCService.java#L10

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=6959CA528DF65E386F5695A917D28F41

import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;

import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.*;

Check warning on line 18 in src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCService.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCService.java#L18

Star import of `org.eclipse.jgit.lib.*` 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=E84422F486A1F2464857A5EDF0121DA7
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
Expand All @@ -29,10 +26,7 @@
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

import de.tum.in.www1.artemis.domain.Commit;
import de.tum.in.www1.artemis.domain.ProgrammingExercise;
import de.tum.in.www1.artemis.domain.User;
import de.tum.in.www1.artemis.domain.VcsRepositoryUrl;
import de.tum.in.www1.artemis.domain.*;

Check warning on line 29 in src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCService.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCService.java#L29

Star import of `de.tum.in.www1.artemis.domain.*` 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=B8D727A7371E360E5988EDA75F01ECC7
import de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseParticipation;
import de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation;
import de.tum.in.www1.artemis.exception.localvc.LocalVCInternalException;
Expand Down Expand Up @@ -321,6 +315,5 @@
catch (IOException e) {
throw new LocalVCInternalException("Unable to get the push date from participation " + participation.getId() + ": " + participation.getRepositoryUrl(), e);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,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