Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/GroupSummary.java =================================================================== diff -u -r281e19ba98aa6bf38fc1f25507a9098304d668fb -r82c531ec90377dbaf474edc1966f9490582a03ff --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/GroupSummary.java (.../GroupSummary.java) (revision 281e19ba98aa6bf38fc1f25507a9098304d668fb) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/GroupSummary.java (.../GroupSummary.java) (revision 82c531ec90377dbaf474edc1966f9490582a03ff) @@ -33,7 +33,7 @@ private String sessionName; private int mark; private int totalAttempts; - private String totalPercentage; + private Double totalPercentage; private Long leaderUid; private boolean scratchingFinished; @@ -95,11 +95,11 @@ this.totalAttempts = totalAttempts; } - public String getTotalPercentage() { + public Double getTotalPercentage() { return totalPercentage; } - public void setTotalPercentage(String totalPercentage) { + public void setTotalPercentage(Double totalPercentage) { this.totalPercentage = totalPercentage; } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java =================================================================== diff -u -rbcb806e82cb1d2f15b11791aeb5e8ff7335e0163 -r82c531ec90377dbaf474edc1966f9490582a03ff --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java (.../ScratchieItem.java) (revision bcb806e82cb1d2f15b11791aeb5e8ff7335e0163) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java (.../ScratchieItem.java) (revision 82c531ec90377dbaf474edc1966f9490582a03ff) @@ -67,6 +67,10 @@ private int mark; @Transient private String correctAnswerLetter; + @Transient + private int correctOnFirstAttemptCount; + @Transient + private double correctOnFirstAttemptPercent; @Override public Object clone() { @@ -131,4 +135,20 @@ public void setCorrectAnswerLetter(String correctAnswerLetters) { this.correctAnswerLetter = correctAnswerLetters; } + + public int getCorrectOnFirstAttemptCount() { + return correctOnFirstAttemptCount; + } + + public void setCorrectOnFirstAttemptCount(int correctOnFirstAttemptCount) { + this.correctOnFirstAttemptCount = correctOnFirstAttemptCount; + } + + public double getCorrectOnFirstAttemptPercent() { + return correctOnFirstAttemptPercent; + } + + public void setCorrectOnFirstAttemptPercent(double correctOnFirstAttemptPercent) { + this.correctOnFirstAttemptPercent = correctOnFirstAttemptPercent; + } } \ No newline at end of file Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== diff -u -r4a3f535791663e116bc76960f4fc1a4933eacabd -r82c531ec90377dbaf474edc1966f9490582a03ff --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 4a3f535791663e116bc76960f4fc1a4933eacabd) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 82c531ec90377dbaf474edc1966f9490582a03ff) @@ -1955,6 +1955,9 @@ List itemList = new LinkedList<>(items); model.put("items", itemList); + Map itemToCorrectOnFirstAttemptMap = itemList.stream() + .collect(Collectors.toMap(ScratchieItem::getUid, Function.identity())); + //correct answers row ScratchieServiceImpl.fillCorrectAnswerLetters(itemList); @@ -1995,18 +1998,26 @@ for (ScratchieItemDTO itemDto : summary.getItemDtos()) { if (itemDto.isUnraveledOnFirstAttempt()) { numberOfFirstChoiceEvents++; + + ScratchieItem item = itemToCorrectOnFirstAttemptMap.get(itemDto.getUid()); + item.setCorrectOnFirstAttemptCount(item.getCorrectOnFirstAttemptCount() + 1); } } summary.setMark(numberOfFirstChoiceEvents); // round the percentage cell String totalPercentage = String.valueOf( Math.round((items.size() == 0) ? 0 : (double) numberOfFirstChoiceEvents * 100 / items.size())); - summary.setTotalPercentage(totalPercentage); + summary.setTotalPercentage(Double.valueOf(totalPercentage)); } - model.put("sessionDtos", groupSummaries); + + for (ScratchieItem item : itemList) { + item.setCorrectOnFirstAttemptPercent( + groupSummaries.isEmpty() ? 0 : item.getCorrectOnFirstAttemptCount() * 100 / groupSummaries.size()); + } + return model; } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/TblMonitorController.java =================================================================== diff -u -r67eb97d89e2400b6dfba6b978f608c376a25a00d -r82c531ec90377dbaf474edc1966f9490582a03ff --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/TblMonitorController.java (.../TblMonitorController.java) (revision 67eb97d89e2400b6dfba6b978f608c376a25a00d) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/TblMonitorController.java (.../TblMonitorController.java) (revision 82c531ec90377dbaf474edc1966f9490582a03ff) @@ -101,7 +101,7 @@ } Double percentage = (items.size() == 0) ? 0 : (double) numberOfFirstChoiceEvents * 100 / items.size(); - summary.setTotalPercentage(percentage.toString()); + summary.setTotalPercentage(percentage); } request.setAttribute("groupSummaries", groupSummaries); Index: lams_tool_scratchie/web/pages/monitoring/studentChoices.jsp =================================================================== diff -u -rbcb806e82cb1d2f15b11791aeb5e8ff7335e0163 -r82c531ec90377dbaf474edc1966f9490582a03ff --- lams_tool_scratchie/web/pages/monitoring/studentChoices.jsp (.../studentChoices.jsp) (revision bcb806e82cb1d2f15b11791aeb5e8ff7335e0163) +++ lams_tool_scratchie/web/pages/monitoring/studentChoices.jsp (.../studentChoices.jsp) (revision 82c531ec90377dbaf474edc1966f9490582a03ff) @@ -115,13 +115,15 @@ - - - - - % - + + + + + + % + + @@ -140,11 +142,13 @@ - - + + + + - + @@ -200,18 +204,64 @@ - + + + bg-success + bg-danger + bg-warning + + + + ${sessionDto.mark} - + % - - + + + + + + + + + bg-success + bg-danger + bg-warning + + + + + ${item.correctOnFirstAttemptCount} + + + + + + + % + + + + bg-success + bg-danger + bg-warning + + + + + % + + + + + +