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

Programming exercises: Fix an issue for grading statistics #9779

Merged
Merged
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
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
Loading