Skip to content

Commit

Permalink
Programming exercises: Fix an issue for grading statistics (#9779)
Browse files Browse the repository at this point in the history
  • Loading branch information
az108 authored Nov 15, 2024
1 parent e152068 commit c1bfa2f
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,25 @@ private static Map<String, Integer> categorizeStaticCodeAnalysisIssues(Result re
private static void updateTestCaseMapBasedOnResultFeedback(Result result, HashMap<String, ProgrammingExerciseGradingStatisticsDTO.TestCaseStats> testCaseStatsMap) {
result.getFeedbacks().stream()
// Filter the feedbacks to include only those that are automatic and have an assigned test case
.filter(feedback -> FeedbackType.AUTOMATIC.equals(feedback.getType()) && feedback.getTestCase() != null)
.filter(feedback -> {
if (!FeedbackType.AUTOMATIC.equals(feedback.getType())) {
return false;
}
if (feedback.getTestCase() == null) {
return false;
}
if (feedback.getTestCase().getTestName() == null) {
// Log the feedback id with null test name to analyse NullPointer issue if it occurs again in the future
log.warn("Feedback with ID {} has a test case with a null test name.", feedback.getId());
return false;
}
if (feedback.isPositive() == null) {
// Log the feedback with null isPositive value to analyse NullPointer issue if it occurs again in the future
log.warn("Feedback with ID {} has a test case with a null isPositive value.", feedback.getId());
return false;
}
return true;
})
// Collect the filtered feedbacks into a map grouped by test case name, and partitioned by whether the feedback is positive
.collect(Collectors.groupingBy(
// Group by the name of the test case associated with the feedback
Expand Down

0 comments on commit c1bfa2f

Please sign in to comment.