-
-
Notifications
You must be signed in to change notification settings - Fork 1k
SAK-52184 Samigo fix Tally errors in some Total Scores/Question Pool/Item Analysis stats #14353
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
base: master
Are you sure you want to change the base?
Conversation
…Item Analysis stats
WalkthroughRefactors tallying and scoring across TotalScoresBean, HistogramListener, and StatisticsService: introduces per-item tallying helpers, switches histogram and calculated-question logic to per-submission aggregation, and adjusts multiple-correct / fill-in scoring decisions and blank-handling. Changes
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.40.5)samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.javaTip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/services/assessment/StatisticsService.java (1)
270-321: Blank FIB/FIN submissions can be double‑counted as incorrect.
WhenpublishedAnswerIdis null,blankResponsesis incremented, but the post‑loop tally still falls through to the incorrect branch becauseblankAnswersstays 0. This can count one submission as both blank and incorrect. Consider tracking a per‑submission blank flag and short‑circuiting before the final tally.Proposed fix
for (Set<ItemGradingData> submissionItemGradingData : itemgradingDataByAssessmentGradingId.values()) { int presentAnswerCount = submissionItemGradingData.size(); int correctAnswers = 0; int incorrectAnswers = 0; int blankAnswers = 0; + boolean hasNullAnswer = false; for (ItemGradingData itemGradingData : submissionItemGradingData) { Long answerId = itemGradingData.getPublishedAnswerId(); if (answerId == null) { // With a blank answer there should only one ItemGradingData per submission // But to be safe, let's break out of the loop to avoid double counting - blankResponses++; - break; + hasNullAnswer = true; + break; } @@ - if (blankAnswers == presentAnswerCount) { + if (hasNullAnswer) { + blankResponses++; + continue; + } + if (blankAnswers == presentAnswerCount) { blankResponses++; } else if (correctAnswers == presentAnswerCount) { correctResponses++;samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java (1)
1851-1876: Histogram bar height should scale by submission count, not item‑gradings.
resultsnow counts submissions, but bar heights divide byscores.size()(item gradings), which can under‑scale bars for multipart calculated questions. Use total submission responses instead.Proposed fix
- for (Map.Entry<String, Integer> resultEntry : results.entrySet()) { + int totalResponses = results.get(CORRECT) + results.get(INCORRECT); + for (Map.Entry<String, Integer> resultEntry : results.entrySet()) { HistogramBarBean bar = new HistogramBarBean(); bar.setLabel(resultEntry.getKey()); bar.setNumStudents(resultEntry.getValue()); bar.setNumStudentsText(String.valueOf(resultEntry.getValue())); bar.setNumStudentsText(resultEntry.getValue() + " " + resultEntry.getKey()); bar.setIsCorrect(resultEntry.getKey().equals(CORRECT)); int height = 0; - if (!scores.isEmpty()) { - height = COLUMN_MAX_HEIGHT * resultEntry.getValue() / scores.size(); + if (totalResponses > 0) { + height = COLUMN_MAX_HEIGHT * resultEntry.getValue() / totalResponses; } bar.setColumnHeight(Integer.toString(height)); barList.add(bar); } @@ - int totalResponses = results.get(CORRECT) + results.get(INCORRECT); if (totalResponses > 0) { double percentCorrect = ((double) results.get(CORRECT) / (double) totalResponses) * 100; String percentCorrectStr = Integer.toString((int) percentCorrect); qbean.setPercentCorrect(percentCorrectStr); }
🤖 Fix all issues with AI agents
In
`@samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/TotalScoresBean.java`:
- Around line 544-562: In TotalScoresBean where TypeIfc.IMAGEMAP_QUESTION is
handled, change the blank-check logic for ItemGradingData answers so that
answerText values equal to the literal "undefined" are treated like blanks;
specifically update the condition that currently uses
StringUtils.isBlank(gradingData.getAnswerText()) to also consider
gradingData.getAnswerText() != null &&
gradingData.getAnswerText().trim().equals("undefined") (or the StringUtils
equivalent) when evaluating hasAnyResponse; keep the rest of the loop and return
semantics (gradingList, getPublishedAnswerId(), getAnswerText(), getIsCorrect())
unchanged.
...samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/TotalScoresBean.java
Show resolved
Hide resolved
|
@ottenhoff Thanks for working on this Sam. Have you finished work on this and applying any of the suggested AI changes? I.e. is this patch ready for me to begin testing? Once this patch is ready for me to proceed I will be able do so, but do know that I will have to balance testing efforts against my current workload over the next couple days / week. Thanks, |
CC: @mylescarey2019 please test .... Code is untested and your Testing Plan is very detailed!
Summary by CodeRabbit
Bug Fixes
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.