Skip to content

Commit

Permalink
Add support for non-instructors (#9)
Browse files Browse the repository at this point in the history
* only prompt to select a course when you have a choice

* allow tutors to use the tool
  • Loading branch information
Luro02 authored Dec 14, 2023
1 parent a56b17e commit 58e01dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/main/java/edu/kit/kastel/sdq/scorestats/cli/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ public void run(String[] args) {
courses.sort(Comparator.comparing(Course::getCourseId));

try (Scanner scanner = new Scanner(System.in)) {

OptionDialogue<Course> courseDialogue = new OptionDialogue<>(scanner, "Please select the course:",
Course course = courses.get(0);
// only prompt if there is more than one course to select from
if (courses.size() > 1) {
OptionDialogue<Course> courseDialogue = new OptionDialogue<>(scanner, "Please select the course:",
courses.stream().collect(Collectors.toMap(Course::getShortName, item -> item, (i1, i2) -> null, LinkedHashMap::new)));
Course course = courseDialogue.prompt();
course = courseDialogue.prompt();
}

List<Exercise> exercises;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -13,6 +14,7 @@
import edu.kit.kastel.sdq.artemis4j.api.artemis.assessment.Feedback;
import edu.kit.kastel.sdq.artemis4j.api.artemis.assessment.Result;
import edu.kit.kastel.sdq.artemis4j.api.artemis.assessment.Submission;
import edu.kit.kastel.sdq.artemis4j.api.client.ISubmissionsArtemisClient;
import edu.kit.kastel.sdq.artemis4j.api.grading.IAnnotation;
import edu.kit.kastel.sdq.artemis4j.client.AssessmentArtemisClient;
import edu.kit.kastel.sdq.artemis4j.client.RestClientManager;
Expand All @@ -26,7 +28,7 @@

/**
* An {@link ArtemisClient} using artemis4j.
*
*
* @author Moritz Hertler
* @version 1.0
*/
Expand All @@ -51,8 +53,13 @@ public List<Course> loadCourses() throws ArtemisClientException {
}

public Assessments<K> loadAssessments(Exercise exercise, ExerciseConfig config) throws ArtemisClientException {
ISubmissionsArtemisClient submissionsClient = this.client.getSubmissionArtemisClient();

List<Submission> submissions = this.client.getSubmissionArtemisClient().getSubmissions(exercise);
Collection<Submission> submissions = new ArrayList<>(submissionsClient.getSubmissions(exercise, 0, false));

if (exercise.hasSecondCorrectionRound()) {
submissions.addAll(submissionsClient.getSubmissions(exercise, 1, false));
}

AnnotationDeserializer deserializer = null;
if (config != null) {
Expand Down

0 comments on commit 58e01dd

Please sign in to comment.