/**
  * @see
  *     org.olat.course.nodes.AssessableCourseNode#getUserLog(org.olat.course.run.userview.UserCourseEnvironment)
  */
 @Override
 public String getUserLog(final UserCourseEnvironment userCourseEnvironment) {
   final UserNodeAuditManager am = userCourseEnvironment.getCourseEnvironment().getAuditManager();
   final String logValue =
       am.getUserNodeLog(this, userCourseEnvironment.getIdentityEnvironment().getIdentity());
   return logValue;
 }
Beispiel #2
0
  private void exposeUserTestDataToVC(UserRequest ureq) {
    // config : show score info
    Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    if (enableScoreInfoObject != null) {
      myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
    } else {
      myContent.contextPut("enableScoreInfo", Boolean.TRUE);
    }
    // configuration data
    myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS));

    // user data
    Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    if (courseNode instanceof PersistentAssessableCourseNode) {
      PersistentAssessableCourseNode acn = (PersistentAssessableCourseNode) courseNode;
      AssessmentEntry assessmentEntry = acn.getUserAssessmentEntry(userCourseEnv);
      if (assessmentEntry == null) {
        myContent.contextPut("blockAfterSuccess", Boolean.FALSE);
        myContent.contextPut("score", null);
        myContent.contextPut("hasPassedValue", Boolean.FALSE);
        myContent.contextPut("passed", Boolean.FALSE);
        myContent.contextPut("comment", null);
        myContent.contextPut("attempts", 0);
      } else {
        // block if test passed (and config set to check it)
        Boolean blockAfterSuccess =
            modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS);
        Boolean blocked = Boolean.FALSE;
        if (blockAfterSuccess != null && blockAfterSuccess.booleanValue()) {
          Boolean passed = assessmentEntry.getPassed();
          if (passed != null && passed.booleanValue()) {
            blocked = Boolean.TRUE;
          }
        }
        myContent.contextPut("blockAfterSuccess", blocked);
        myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
        myContent.contextPut(
            "hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
        myContent.contextPut("passed", assessmentEntry.getPassed());
        StringBuilder comment = Formatter.stripTabsAndReturns(assessmentEntry.getComment());
        myContent.contextPut("comment", StringHelper.xssScan(comment));
        myContent.contextPut("attempts", assessmentEntry.getAttempts());
      }
    }

    UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
    myContent.contextPut("log", am.getUserNodeLog(courseNode, identity));

    exposeResults(ureq);
  }