Skip to content

Commit

Permalink
Fixes for type cast issue in assessment submit
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Mar 24, 2022
1 parent 0918f51 commit 692d7c2
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Map<String, Object> validateQumlAssessment(List<String> originalQuestionL
case MCQ_MCA:
for (Map<String, Object> option : options) {
if ((boolean) option.get(SELECTED_ANSWER)) {
marked.add(Integer.toString((int) option.get(INDEX)));
marked.add((String) option.get(INDEX));
}
}
break;
Expand Down Expand Up @@ -131,23 +131,25 @@ private Map<String, Object> getQumlAnswers(List<String> questions) throws Except
if (question.containsKey(QUESTION_TYPE)) {
String questionType = ((String) question.get(QUESTION_TYPE)).toLowerCase();
Map<String, Object> editorStateObj = (Map<String, Object>) question.get(EDITOR_STATE);
List<Map<String, Object>> options = (List<Map<String, Object>>) editorStateObj.get(OPTIONS);
switch (questionType) {
case MTF:
for (Map<String, Object> options : (List<Map<String, Object>>) editorStateObj.get(OPTIONS)) {
Map<String, Object> valueObj = (Map<String, Object>) options.get(VALUE);
correctOption
.add(valueObj.get(VALUE).toString() + "-" + valueObj.get(BODY).toString().toLowerCase()
+ "-" + options.get(ANSWER).toString().toLowerCase());
for (Map<String, Object> option : options) {
Map<String, Object> valueObj = (Map<String, Object>) option.get(VALUE);
correctOption.add(
valueObj.get(VALUE).toString() + "-" + option.get(ANSWER).toString().toLowerCase());
}
break;
case FTB:
correctOption.add((String) editorStateObj.get(ANSWER));
for (Map<String, Object> option : options) {
correctOption.add((String) option.get(SELECTED_ANSWER));
}
break;
case MCQ_SCA:
case MCQ_MCA:
for (Map<String, Object> options : (List<Map<String, Object>>) editorStateObj.get(OPTIONS)) {
if ((boolean) options.get(ANSWER)) {
Map<String, Object> valueObj = (Map<String, Object>) options.get(VALUE);
for (Map<String, Object> option : options) {
if ((boolean) option.get(ANSWER)) {
Map<String, Object> valueObj = (Map<String, Object>) option.get(VALUE);
correctOption.add(valueObj.get(VALUE).toString());
}
}
Expand Down

0 comments on commit 692d7c2

Please sign in to comment.