Package org.olat.ims.qti

Examples of org.olat.ims.qti.QTIResultSet


   */

  public void persistResults(AssessmentInstance ai, long resId, String resDetail, UserRequest ureq) {
    AssessmentContext ac = ai.getAssessmentContext();
   
    QTIResultSet qtiResultSet = new QTIResultSet();
    qtiResultSet.setLastModified(new Date(System.currentTimeMillis()));
    qtiResultSet.setOlatResource(resId);
    qtiResultSet.setOlatResourceDetail(resDetail);
    qtiResultSet.setRepositoryRef(ai.getRepositoryEntryKey());
    qtiResultSet.setIdentity(ureq.getIdentity());
    qtiResultSet.setQtiType(ai.getType());
    qtiResultSet.setAssessmentID(ai.getAssessID());
   
    qtiResultSet.setDuration(new Long(ai.getAssessmentContext().getDuration()));
    // TODO qtiResultSet.setLastModified();
   
    if (ai.isSurvey()){
      qtiResultSet.setScore(0);
      qtiResultSet.setIsPassed(true);
    } else {
      qtiResultSet.setScore(ac.getScore());
      qtiResultSet.setIsPassed(ac.isPassed());
    }
   
    DBFactory.getInstance().saveObject(qtiResultSet);
   
    // Loop over all sections in this assessment
View Full Code Here


   * @param olatResource
   * @param olatResourceDetail
   * @return Returns the last recorded QTIResultSet
   */
  public QTIResultSet getLastResultSet(Identity identity, long olatResource, String olatResourceDetail) {
    QTIResultSet returnQTIResultSet=null;
    DB persister = DBFactory.getInstance();
    List resultSetList =  persister.find("from q in class org.olat.ims.qti.QTIResultSet where "
        + "q.identity = ? and q.olatResource = ? and q.olatResourceDetail = ? order by q.creationDate desc", new Object[]{identity.getKey(), new Long(olatResource), new String(olatResourceDetail)},
        new Type[]{Hibernate.LONG, Hibernate.LONG, Hibernate.STRING});
    Iterator resultSetIterator = resultSetList.iterator();
View Full Code Here

   * @param olatResource is the course id
   * @param olatResourceDetail is the node id
   * @return Returns the last assessmentID if at least a QTIResultSet was stored for the input variables, null otherwise.
   */
  public Long getLastAssessmentID(Identity identity, long olatResource, String olatResourceDetail) {
    QTIResultSet resultSet = getLastResultSet(identity, olatResource, olatResourceDetail);
    if(resultSet!=null) {
      return resultSet.getAssessmentID();
    }
    return null;
  }
View Full Code Here

            QTIResultManager qrm = QTIResultManager.getInstance();
            List testResultSets = qrm.getResultSets(course.getResourceableId(), test.getIdent(),
                test.getReferencedRepositoryEntry().getKey(), null);

            for (Iterator j = testResultSets.iterator(); j.hasNext();) {
              QTIResultSet qrs = (QTIResultSet) j.next();
              // - modify date on test set must be newer than last visit of
              // assessment tool
              // - user must either be course administrator (access to all
              // users granted)
              // or in a course right group with the assessment tool right or
              // a course
              // coach. in the second case, only tests of users are shown that
              // the coach does actually
              // coach himself. he does not have access to other users
              Date modDate = qrs.getLastModified();
              if (modDate.after(compareDate) && (hasFullAccess || PersistenceHelper.listContainsObjectByKey(coachedUsers, qrs.getIdentity()))) {
                String score = (new Float(qrs.getScore())).toString();
                String desc = translator.translate("notifications.entry", new String[] { test.getShortTitle(),
                    NotificationHelper.getFormatedName(qrs.getIdentity()), score });

                String urlToSend = null;
                if(p.getBusinessPath() != null) {
                  String businessPath = p.getBusinessPath() + "[assessmentTool:0][Identity:" + qrs.getIdentity().getKey() + "][CourseNode:" + test.getIdent() + "]";
                  urlToSend = NotificationHelper.getURLFromBusinessPathString(p, businessPath);
                }
                SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, modDate, CSS_CLASS_USER_ICON);
                si.addSubscriptionListItem(subListItem);
              }
View Full Code Here

   * @see org.olat.course.nodes.SelfAssessableCourseNode#getUserScoreEvaluation(org.olat.course.run.userview.UserCourseEnvironment)
   */
  public ScoreEvaluation getUserScoreEvaluation(UserCourseEnvironment userCourseEnv) {
    Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    long olatResourceId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
    QTIResultSet qTIResultSet = IQManager.getInstance().getLastResultSet(identity, olatResourceId, this.getIdent());
    if(qTIResultSet!=null) {
      ScoreEvaluation scoreEvaluation = new ScoreEvaluation(new Float(qTIResultSet.getScore()), new Boolean(qTIResultSet.getIsPassed()), new Long(qTIResultSet.getAssessmentID()));
      return scoreEvaluation;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.QTIResultSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.