Skip to content

Commit

Permalink
Revert "SAK-47629 samigo: Add incorrect answer filter to student feed…
Browse files Browse the repository at this point in the history
…back (sakaiproject#10770)"

This reverts commit e1eea0f.
  • Loading branch information
ern committed Oct 17, 2022
1 parent 2e7b992 commit 782f0bd
Show file tree
Hide file tree
Showing 25 changed files with 127 additions and 272 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public interface AssessmentFeedbackIfc
public static final Integer BOTH_FEEDBACK = 3;
public static final Integer SELECT_COMPONENTS = 2; // select feedback components
public static final Integer SHOW_TOTALSCORE_ONLY = 1; // select feedback components
public static final Integer ALL_QUESTIONS = 1; // select all question
public static final Integer INCORRECT_QUESTIONS = 2; // select only incorrect questions

Long getId();

Expand Down Expand Up @@ -100,8 +98,4 @@ public interface AssessmentFeedbackIfc

void setFeedbackComponentOption(Integer feedbackComponentOption);

Integer getCorrectAnswerOption();

void setCorrectAnswerOption(Integer correctAnswerOption);

}
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ objective=Objective:
one_per=(one per line)
only=Only
only_next= There are only NEXT buttons only to go forward.
only_showing_incorrect=Feedback is configured to only show incorrect responses. This means you won't see items \
that you have answered correctly.
org=Organization
p=Part
p_information=Part Information:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ alt_sortLastModifiedDescending=Sort by Last Modified in Descending

feedback_components_select=Display questions and additional feedback (options expand when selected)
feedback_components_totalscore_only=Only display the student's total score (questions not shown)
feedback_components_all_questions=All questions
feedback_components_incorrect_questions_only=Only incorrect questions

locked_browser=Require Locked Browser

Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ public class AssessmentSettingsBean extends SpringBeanAutowiringSupport implemen
// properties of AssesmentFeedback
private String feedbackDelivery; // immediate, on specific date , no feedback
private String feedbackComponentOption; // 2 = select options, 1 = total scores only
private String correctAnswerOption;

//private String editComponents; // 0 = cannot
private boolean showQuestionText = true;
Expand Down Expand Up @@ -408,10 +407,6 @@ public void setAssessment(AssessmentFacade assessment) {
if (feedback.getFeedbackComponentOption()!=null)
this.feedbackComponentOption = feedback.getFeedbackComponentOption().toString();

if (feedback.getCorrectAnswerOption() != null) {
this.correctAnswerOption = feedback.getCorrectAnswerOption().toString();
}

if (feedback.getFeedbackAuthoring()!=null)
this.feedbackAuthoring = feedback.getFeedbackAuthoring().toString();

Expand Down Expand Up @@ -880,14 +875,6 @@ public String getFeedbackComponentOption() {
public void setFeedbackComponentOption(String feedbackComponentOption) {
this.feedbackComponentOption = feedbackComponentOption;
}

public String getCorrectAnswerOption() {
return this.correctAnswerOption;
}

public void setCorrectAnswerOption(String correctAnswerOption) {
this.correctAnswerOption = correctAnswerOption;
}

public boolean getShowQuestionText() {
return showQuestionText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ public class PublishedAssessmentSettingsBean extends SpringBeanAutowiringSupport
// properties of PublishedFeedback
private String feedbackDelivery; // immediate, on specific date , no feedback
private String feedbackComponentOption; // 2 = select options, 1 = total scores only
private String correctAnswerOption;
private String feedbackAuthoring;
private boolean showQuestionText = false;
private boolean showStudentResponse = false;
Expand Down Expand Up @@ -384,10 +383,6 @@ public void setAssessment(PublishedAssessmentFacade assessment) {
if (feedback.getFeedbackComponentOption()!=null)
this.feedbackComponentOption = feedback.getFeedbackComponentOption().toString();

if (feedback.getCorrectAnswerOption() != null) {
this.correctAnswerOption = feedback.getCorrectAnswerOption().toString();
}

if (feedback.getFeedbackAuthoring()!=null)
this.feedbackAuthoring = feedback.getFeedbackAuthoring().toString();

Expand Down Expand Up @@ -829,14 +824,6 @@ public void setFeedbackComponentOption(String feedbackComponentOption) {
this.feedbackComponentOption = feedbackComponentOption;
}

public String getCorrectAnswerOption() {
return this.correctAnswerOption;
}

public void setCorrectAnswerOption(String correctAnswerOption) {
this.correctAnswerOption = correctAnswerOption;
}

public String getFeedbackAuthoring() {
return feedbackAuthoring;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ public class DeliveryBean implements Serializable {
@Getter @Setter
private String feedbackComponentOption;
@Getter @Setter
private boolean onlyShowingIncorrect = false;
@Getter @Setter
private boolean feedbackOnDate;
@Getter @Setter
private String errorMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class DeliveryBeanie
@Getter @Setter private Double feedbackScoreThreshold;
private String feedbackDelivery;
private String feedbackComponentOption;
@Getter @Setter private String correctAnswerOption;
private String showScore;
private String submissionHours;
private String submissionMinutes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
package org.sakaiproject.tool.assessment.ui.bean.delivery;
import java.io.Serializable;

import lombok.Getter;

import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentFeedbackIfc;

/**
Expand All @@ -51,7 +49,6 @@ public class FeedbackComponent implements Serializable
private boolean showStudentQuestionScore;
private boolean showDateFeedback;
private boolean showNoFeedback;
@Getter private Integer correctAnswerOption;

/**
*
Expand Down Expand Up @@ -286,8 +283,6 @@ public void setAssessmentFeedback(AssessmentFeedbackIfc feedback){
setShowImmediate(AssessmentFeedbackIfc.IMMEDIATE_FEEDBACK.equals(feedbackDelivery));
setShowOnSubmission(AssessmentFeedbackIfc.FEEDBACK_ON_SUBMISSION.equals(feedbackDelivery));
setShowNoFeedback(AssessmentFeedbackIfc.NO_FEEDBACK.equals(feedbackDelivery));

this.correctAnswerOption = feedback.getCorrectAnswerOption();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@ public AssessmentFacade save(AssessmentSettingsBean assessmentSettings, boolean
feedback.setFeedbackDelivery(new Integer(assessmentSettings.getFeedbackDelivery()));
if (StringUtils.isNotBlank(assessmentSettings.getFeedbackComponentOption()))
feedback.setFeedbackComponentOption(new Integer(assessmentSettings.getFeedbackComponentOption()));

if (StringUtils.isNotBlank(assessmentSettings.getCorrectAnswerOption())) {
feedback.setCorrectAnswerOption(new Integer(assessmentSettings.getCorrectAnswerOption()));
}

if (assessmentSettings.getFeedbackAuthoring()!=null)
feedback.setFeedbackAuthoring(new Integer(assessmentSettings.getFeedbackAuthoring()));
// if 'No feedback' (it corresponds to value 3) is selected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,6 @@ else if ("".equals(assessmentSettings.getRetractDateString())) {
if (StringUtils.isNotBlank(assessmentSettings.getFeedbackComponentOption()))
feedback.setFeedbackComponentOption(new Integer(assessmentSettings.getFeedbackComponentOption()));

if (StringUtils.isNotBlank(assessmentSettings.getCorrectAnswerOption())) {
feedback.setCorrectAnswerOption(new Integer(assessmentSettings.getCorrectAnswerOption()));
}

control.setFeedbackDate(assessmentSettings.getFeedbackDate());
control.setFeedbackEndDate(assessmentSettings.getFeedbackEndDate());
//Set the value if the checkbox is selected, wipe the value otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void populateBeanFromPub(DeliveryBean delivery,
else {
delivery.setFeedbackComponentOption("1");
}

// important: set feedbackOnDate last
Date currentDate = new Date();
if (component.getShowDateFeedback()) {
Expand All @@ -254,7 +254,7 @@ private FeedbackComponent populateFeedbackComponent(PublishedAssessmentFacade pu
{
FeedbackComponent component = new FeedbackComponent();
AssessmentFeedbackIfc info = pubAssessment.getAssessmentFeedback();
if (info != null) {
if ( info != null) {
component.setAssessmentFeedback(info);
}
return component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.stream.Collectors;

import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
Expand Down Expand Up @@ -246,74 +244,73 @@ public void processAction(ActionEvent ae) throws
break;

case 3: // Review assessment
setFeedbackMode(delivery); //this determine if we should gather the itemGrading
Integer scoringoption = publishedAssessment.getEvaluationModel().getScoringType();
String assessmentGradingId = ContextUtil.lookupParam("assessmentGradingId");
setFeedbackMode(delivery); //this determine if we should gather the itemGrading
Integer scoringoption = publishedAssessment.getEvaluationModel().getScoringType();
String assessmentGradingId = ContextUtil.lookupParam("assessmentGradingId");

if (("true").equals(delivery.getFeedback())) {
if (("true").equals(delivery.getFeedback())){
itemGradingHash = new HashMap();
if (delivery.getFeedbackComponent().getShowResponse()
|| delivery.getFeedbackComponent().getShowStudentQuestionScore()
||delivery.getFeedbackComponent().getShowItemLevel()) {

if (delivery.getFeedbackComponent().getShowResponse() || delivery.getFeedbackComponent().getShowStudentQuestionScore() ||
delivery.getFeedbackComponent().getShowItemLevel())
itemGradingHash = service.getSubmitData(id, agent, scoringoption, assessmentGradingId);
}
ag = setAssessmentGradingFromItemData(delivery, itemGradingHash, false);
delivery.setAssessmentGrading(ag);
}
setDisplayByAssessment(delivery);
FeedbackComponent component = new FeedbackComponent();
AssessmentFeedbackIfc info = (AssessmentFeedbackIfc) publishedAssessment.getAssessmentFeedback();
if ( info != null) {
component.setAssessmentFeedback(info);
}
delivery.setFeedbackComponent(component);
AssessmentGradingData agData = null;
if (EvaluationModelIfc.LAST_SCORE.equals(scoringoption)){
agData = (AssessmentGradingData) service.getLastSubmittedAssessmentGradingByAgentId(id, agent, assessmentGradingId);
} else {
agData = (AssessmentGradingData) service.getHighestSubmittedAssessmentGrading(id, agent, assessmentGradingId);
}
if (agData == null) {
delivery.setOutcome("reviewAssessmentError");
return;
}

//agData.setItemGradingSet(agData.getItemGradingSet().stream().filter(gd -> !gd.getIsCorrect()).collect(Collectors.toSet()));
log.debug("GraderComments: getComments()" + agData.getComments());
delivery.setGraderComment(agData.getComments());
delivery.setAssessmentGradingAttachmentList(agData.getAssessmentGradingAttachmentList());
delivery.setHasAssessmentGradingAttachment(
agData.getAssessmentGradingAttachmentList() != null && agData.getAssessmentGradingAttachmentList().size() > 0);
delivery.setAssessmentGradingId(agData.getAssessmentGradingId());
delivery.setOutcome("takeAssessment");
delivery.setSecureDeliveryHTMLFragment( "" );
delivery.setBlockDelivery( false );

if ( secureDelivery.isSecureDeliveryAvaliable() ) {
String moduleId = publishedAssessment.getAssessmentMetaDataByLabel( SecureDeliveryServiceAPI.MODULE_KEY );
if ( moduleId != null && ! SecureDeliveryServiceAPI.NONE_ID.equals( moduleId ) ) {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
PhaseStatus status = secureDelivery.validatePhase(moduleId, Phase.ASSESSMENT_REVIEW, publishedAssessment, request );
delivery.setSecureDeliveryHTMLFragment(
secureDelivery.getHTMLFragment(moduleId, publishedAssessment, request, Phase.ASSESSMENT_REVIEW, status, new ResourceLoader().getLocale() ) );
if ( PhaseStatus.FAILURE == status ) {
delivery.setOutcome( "secureDeliveryError" );
delivery.setBlockDelivery( true );
}
setDisplayByAssessment(delivery);
//setDeliveryFeedbackOnforEvaluation(delivery);
//setGraderComment(delivery);
FeedbackComponent component = new FeedbackComponent();
AssessmentFeedbackIfc info = (AssessmentFeedbackIfc) publishedAssessment.getAssessmentFeedback();
if ( info != null) {
component.setAssessmentFeedback(info);
}
delivery.setFeedbackComponent(component);
AssessmentGradingData agData = null;
if (EvaluationModelIfc.LAST_SCORE.equals(scoringoption)){
agData = (AssessmentGradingData) service.getLastSubmittedAssessmentGradingByAgentId(id, agent, assessmentGradingId);
} else {
agData = (AssessmentGradingData) service.getHighestSubmittedAssessmentGrading(id, agent, assessmentGradingId);
}
if (agData == null) {
delivery.setOutcome("reviewAssessmentError");
return;
}
log.debug("GraderComments: getComments()" + agData.getComments());
delivery.setGraderComment(agData.getComments());
delivery.setAssessmentGradingAttachmentList(agData.getAssessmentGradingAttachmentList());
delivery.setHasAssessmentGradingAttachment(
agData.getAssessmentGradingAttachmentList() != null && agData.getAssessmentGradingAttachmentList().size() > 0);
delivery.setAssessmentGradingId(agData.getAssessmentGradingId());
delivery.setOutcome("takeAssessment");
delivery.setSecureDeliveryHTMLFragment( "" );
delivery.setBlockDelivery( false );

if ( secureDelivery.isSecureDeliveryAvaliable() ) {

String moduleId = publishedAssessment.getAssessmentMetaDataByLabel( SecureDeliveryServiceAPI.MODULE_KEY );
if ( moduleId != null && ! SecureDeliveryServiceAPI.NONE_ID.equals( moduleId ) ) {

HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
PhaseStatus status = secureDelivery.validatePhase(moduleId, Phase.ASSESSMENT_REVIEW, publishedAssessment, request );
delivery.setSecureDeliveryHTMLFragment(
secureDelivery.getHTMLFragment(moduleId, publishedAssessment, request, Phase.ASSESSMENT_REVIEW, status, new ResourceLoader().getLocale() ) );
if ( PhaseStatus.FAILURE == status ) {
delivery.setOutcome( "secureDeliveryError" );
delivery.setBlockDelivery( true );
}
}
}
}

generateSecureTokenForAssessment(delivery);
generateSecureTokenForAssessment(delivery);

// post event
eventRef = new StringBuffer("publishedAssessmentId=");
eventRef.append(delivery.getAssessmentId());
eventRef.append(", submissionId=");
eventRef.append(agData.getAssessmentGradingId());
event = eventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_REVIEW, eventRef.toString(), true);
eventTrackingService.post(event);
break;
// post event
eventRef = new StringBuffer("publishedAssessmentId=");
eventRef.append(delivery.getAssessmentId());
eventRef.append(", submissionId=");
eventRef.append(agData.getAssessmentGradingId());
event = eventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_REVIEW, eventRef.toString(), true);
eventTrackingService.post(event);
break;

case 4: // Grade assessment
String gradingData = ContextUtil.lookupParam("gradingData");
Expand Down Expand Up @@ -840,20 +837,14 @@ private ContentsDeliveryBean getPageContentsByAssessment(
SectionContentsBean partBean = getPartBean( (SectionDataIfc) iter.next(),
itemGradingHash, delivery,
publishedAnswerHash);

// If we are in review mode and only show incorrect responses is checked in the
// assignment settings, there may well be no parts added. If so, we want to skip
// the empty section but still do the max score calculations.
if (partBean.getItemContents().size() > 0) {
partBean.setNumParts(Integer.toString(partSet.size()));
if (partBean.getItemContentsSize().equals("0")) {
log.debug("getPageContentsByAssessment(): no question");
partBean.setNoQuestions(true);
}
partsContents.add(partBean);
partBean.setNumParts(Integer.toString(partSet.size()));
if (partBean.getItemContentsSize().equals("0")) {
log.debug("getPageContentsByAssessment(): no question");
partBean.setNoQuestions(true);
}
currentScore += partBean.getPoints();
maxScore += partBean.getMaxPoints();
partsContents.add(partBean);
}

delivery.setPrevious(false);
Expand Down Expand Up @@ -1083,14 +1074,7 @@ private SectionContentsBean getPartBean(SectionDataIfc part, Map itemGradingHash
{
unansweredQuestions++;
}

Integer correctAnswerOption = delivery.getFeedbackComponent().getCorrectAnswerOption();
delivery.setOnlyShowingIncorrect(correctAnswerOption == AssessmentFeedbackIfc.INCORRECT_QUESTIONS);
if (delivery.getActionMode() != DeliveryBean.REVIEW_ASSESSMENT) {
itemContents.add(itemBean);
} else if (correctAnswerOption == AssessmentFeedbackIfc.ALL_QUESTIONS || itemBean.getItemGradingDataArray().stream().anyMatch(gd -> gd.getIsCorrect() == null || !gd.getIsCorrect())) {
itemContents.add(itemBean);
}
itemContents.add(itemBean);
}

// scoring information
Expand Down
Loading

0 comments on commit 782f0bd

Please sign in to comment.