Skip to content

Commit

Permalink
SAM-1579: problems with samigo matching questions with distractors
Browse files Browse the repository at this point in the history
* incorrect scoring
* matching pairs don't show on question screen in student response column if no input from quiz-taker
* inconsistent display of answer keys
  • Loading branch information
gpp8p authored and bjones86 committed Feb 27, 2018
1 parent ff61c32 commit b8b36a9
Show file tree
Hide file tree
Showing 15 changed files with 412 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public interface ItemTextIfc
List<AnswerIfc> getAnswerArray();

List<AnswerIfc> getAnswerArraySorted();

List<AnswerIfc> getAnswerArrayWithDistractorSorted();

Set<ItemTextAttachmentIfc> getItemTextAttachmentSet();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ no_submission=No Submission
submitted=Submitted
download_all=Download All
no_answer=No Answer
none_above=None of the Above
paging_status=Viewing {0} - {1} of {2} items
search_find=Find
search_clear=Clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MatchItemBean implements Serializable {

private static final long serialVersionUID = 7526471155622776147L;
public static final String CONTROLLING_SEQUENCE_DEFAULT = "*new*";
public static final String CONTROLLING_SEQUENCE_DISTRACTOR = "*distractor*";
public static final String CONTROLLING_SEQUENCE_DISTRACTOR = "*None of the Above*";
// private String text;
private Long sequence;
// private String corrfeedback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,16 @@ public Boolean getIsCorrect()
return true;
return false;
*/
return isCorrect;
if(this.getIsDistractor()){
if(this.response==null) return false;
if(Integer.parseInt(this.response)<0){
return true;
}else{
return false;
}
}else{
return isCorrect;
}
}

public boolean getIsDistractor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public class QuestionScoresBean
private String typeId;
private Map scoresByItem;

private String marker;

//private String selectedSectionFilterValue = TotalScoresBean.ALL_SECTIONS_SELECT_VALUE;
private String selectedSectionFilterValue = null;

Expand Down Expand Up @@ -263,6 +265,15 @@ public String getAssessmentId()
return Validator.check(assessmentId, "0");
}

public String getMarker()
{
return marker;
}

public void setMarker(String s){
marker = s;
}

/**
* set assessment id
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,49 @@ else if (answer !=null) {
key += " | ";
}

if (item.getTypeId().equals(TypeIfc.MATCHING)){
Iterator itemTexts = itemBean.getItemData().getItemTextArray().iterator();
StringBuffer distractorKeys = new StringBuffer();
while(itemTexts.hasNext()){
ItemTextIfc thisItemText = (ItemTextIfc) itemTexts.next();
Iterator thisItemAnswersIterator = thisItemText.getAnswerArray().iterator();
boolean hasCorrectAnswer = false;
while(thisItemAnswersIterator.hasNext()){
AnswerIfc thisItemAnswer = (AnswerIfc) thisItemAnswersIterator.next();
if(thisItemAnswer.getIsCorrect())hasCorrectAnswer=true;
}
if(!hasCorrectAnswer){
distractorKeys.append(", ");
distractorKeys.append(thisItemText.getSequence());

String noneOfTheAboveOption = Character.toString(alphabet.charAt(myanswers.size()));
// distractorKeys.append(":N/A ");
distractorKeys.append(":"+noneOfTheAboveOption);
}
}
if(distractorKeys.length()>0){
key = key+distractorKeys.toString();
}
String individualKeys[] = key.split(",");
for(int k = 0;k<individualKeys.length;k++){
String thisIndividualKey = individualKeys[k].trim();
individualKeys[k] = thisIndividualKey;
}
Arrays.sort(individualKeys);
StringBuffer sortedKeysBuffer = new StringBuffer();
for(int k = 0;k<individualKeys.length;k++){
if(k==(individualKeys.length-1)){
sortedKeysBuffer.append(" ");
sortedKeysBuffer.append(individualKeys[k]);
}else{
sortedKeysBuffer.append(" ");
sortedKeysBuffer.append(individualKeys[k]);
sortedKeysBuffer.append(",");
}
}
key = sortedKeysBuffer.toString();
}

itemBean.setKey(key);

// Delete this
Expand Down Expand Up @@ -1899,9 +1942,15 @@ public void populateMatching(ItemDataIfc item, ItemContentsBean bean, Map publis

GradingService gs = new GradingService();
if (gs.hasDistractors(item)) {
String noneOfTheAboveOption = Character.toString(alphabet.charAt(i++));
newAnswers.add(noneOfTheAboveOption + "." + " None of the Above");
// choices.add(new SelectItem(NONE_OF_THE_ABOVE.toString(),
// "None of the Above",
// ""));

choices.add(new SelectItem(NONE_OF_THE_ABOVE.toString(),
"None of the Above",
""));
noneOfTheAboveOption,
""));
}

mbean.setChoices(choices); // Set the A/B/C... pulldown
Expand Down
Loading

0 comments on commit b8b36a9

Please sign in to comment.