Skip to content

Commit

Permalink
Update Artemis4J
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Dec 7, 2023
1 parent 08c6ffa commit a593958
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>edu.kit.kastel.sdq</groupId>
<artifactId>artemis4j</artifactId>
<version>6.7.0</version>
<version>6.7.1</version>
</dependency>
<dependency>
<groupId>org.jcommander</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ public PrefixMatcher(String prefix) {
}

/**
* Returns {@code true} if {@link Feedback#getText()} begins with the prefix.
* Returns {@code true} if {@link Feedback#getTestName()} begins with the prefix.
*
* @param feedback the feedback
* @return {@code true} if {@link Feedback#getText()} begins with the prefix
* @return {@code true} if {@link Feedback#getTestName()} begins with the prefix
*/
@Override
public boolean matches(Feedback feedback) {
if (feedback.getFeedbackType() == FeedbackType.MANUAL_UNREFERENCED) {
if (feedback.getFeedbackType() == FeedbackType.MANUAL_UNREFERENCED || !feedback.isTest()) {
throw new IllegalArgumentException();
}

return feedback.getText().startsWith(this.prefix);
return feedback.getTestName().startsWith(this.prefix);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
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.grading.IAnnotation;
import edu.kit.kastel.sdq.artemis4j.client.AssessmentArtemisClient;
import edu.kit.kastel.sdq.artemis4j.client.RestClientManager;
import edu.kit.kastel.sdq.artemis4j.grading.artemis.AnnotationDeserializer;
import edu.kit.kastel.sdq.artemis4j.grading.config.ExerciseConfig;
Expand Down Expand Up @@ -65,13 +66,7 @@ public Assessments<K> loadAssessments(Exercise exercise, ExerciseConfig config)
for (Submission submission : submissions) {
Result result = submission.getLatestResult();
List<Feedback> feedbacks = this.client.getAssessmentArtemisClient().getFeedbacks(submission, result);
feedbacks.forEach(Feedback::init);
boolean success = loadDetailText(result, feedbacks);
if (!success) {
skippedStudents.add(submission.getParticipantIdentifier());
continue;
}

feedbacks.forEach(f -> f.init((AssessmentArtemisClient)this.client.getAssessmentArtemisClient(), result.id));
List<IAnnotation> annotations = List.of();
if (config != null) {
try {
Expand All @@ -94,24 +89,4 @@ public Assessments<K> loadAssessments(Exercise exercise, ExerciseConfig config)

return new Assessments<>(skippedStudents, assessments);
}

private boolean loadDetailText(Result result, List<Feedback> feedbacks) {
for (Feedback feedback : feedbacks) {
if (!feedback.hasLongFeedbackText()) {
continue;
}

String longText;
try {
longText = this.client.getAssessmentArtemisClient().getLongFeedback(result.id, feedback);
} catch (ArtemisClientException e) {
return false;
}

feedback.setDetailTextComplete(longText);
}

return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Iterable<Assessment<K>> iterable(ReportData<K> data) {
@Override
public List<String> count(Assessment<K> value) {
FeedbackGroup feedbackGroup = value.getFeedbackGroup(this.key);
return feedbackGroup.getFailedFeedbacks().stream().map(Feedback::getText).toList();
return feedbackGroup.getFailedFeedbacks().stream().map(Feedback::getTestName).toList();
}

@Override
Expand Down

0 comments on commit a593958

Please sign in to comment.