private void setMCAndSCCorrectResponses(
      Question question, List<Response> responses, FormLayoutContainer layoutCont) {
    List<String> correctResponseNames = new ArrayList<>();
    List<ResponseAndPoints> responsesPoints = new ArrayList<>();
    if (responses != null && responses.size() > 0) {

      if (question.isSingleCorrect()) {
        for (Response response : responses) {
          if (response.isCorrect()) {
            String responseSummary = getResponseSummary(response);
            if (responseSummary != null) {
              correctResponseNames.add(responseSummary);
            }
          }
        }
      } else {
        boolean hasNegative = false;
        for (Response response : responses) {
          if (response.getPoints() < 0.0f) {
            hasNegative = true;
          }
        }

        for (Response response : responses) {
          String responseSummary = getResponseSummary(response);
          if (responseSummary != null
              && ((hasNegative && response.getPoints() >= 0.0f)
                  || (!hasNegative && response.getPoints() > 0.0f))) {
            boolean correct = response.getPoints() > 0.0f;
            String points = Float.toString(response.getPoints());
            ResponseAndPoints responseInfos =
                new ResponseAndPoints(responseSummary, points, correct);
            responsesPoints.add(responseInfos);
          }
        }
      }
    }
    layoutCont.contextPut("responses", correctResponseNames);
    layoutCont.contextPut("responsesAndPoints", responsesPoints);
  }
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    Question question = item.getQuestion();

    FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;

    if (question != null) {
      layoutCont.contextPut("hasQuestion", Boolean.TRUE);

      // settings
      String shuffleStr = translate(question.isShuffle() ? "editor.true" : "editor.false");
      uifactory.addStaticTextElement("form.imd.shuffle", shuffleStr, formLayout);

      String duration = "";
      if (item.getDuration() != null) {
        duration = item.getDuration().getMin() + ":" + item.getDuration().getSec();
      }
      uifactory.addStaticTextElement("form.metadata.duration", duration, formLayout);

      if (question instanceof ChoiceQuestion) {
        ChoiceQuestion choice = (ChoiceQuestion) question;
        if (item.getQuestion().getType() == Question.TYPE_SC) {
          String score = Float.toString(question.getSingleCorrectScore());
          uifactory.addStaticTextElement("score", score, formLayout);
        } else if (item.getQuestion().getType() == Question.TYPE_MC) {
          String minVal = Float.toString(choice.getMinValue());
          String maxVal = Float.toString(choice.getMaxValue());
          uifactory.addStaticTextElement("score.min", minVal, formLayout);
          uifactory.addStaticTextElement("score.max", maxVal, formLayout);
        }
      }

      // correct responses
      List<Response> responses = question.getResponses();
      if (question.getType() == Question.TYPE_MC || question.getType() == Question.TYPE_SC) {
        setMCAndSCCorrectResponses(question, responses, layoutCont);
      } else if (question.getType() == Question.TYPE_KPRIM) {
        setKPrimCorrectResponses(responses, layoutCont);
      }
    }

    // feedbacks
    boolean hasFeedbacks = false;
    Material masteryMat = QTIEditHelper.getFeedbackMasteryMaterial(item);
    if (masteryMat != null) {
      layoutCont.contextPut("item_feedback_mastery", masteryMat.renderAsText());
      hasFeedbacks = true;
    }

    Material failureMat = QTIEditHelper.getFeedbackFailMaterial(item);
    if (failureMat != null) {
      layoutCont.contextPut("item_feedback_fail", failureMat.renderAsText());
      hasFeedbacks = true;
    }

    List<String> responsesFeedback = new ArrayList<>();
    if (question != null && question.getType() <= Question.TYPE_MC) {
      for (Object obj : question.getResponses()) {
        ChoiceResponse response = (ChoiceResponse) obj;
        Material responseFeedbackMat =
            QTIEditHelper.getFeedbackOlatRespMaterial(item, response.getIdent());
        if (responseFeedbackMat != null) {
          responsesFeedback.add(responseFeedbackMat.renderAsText());
        }
      }
      hasFeedbacks |= responsesFeedback.size() > 0;
    }

    layoutCont.contextPut("responsesFeedback", responsesFeedback);
    layoutCont.contextPut("hasFeedbacks", new Boolean(hasFeedbacks));
  }