Пример #1
0
  public ExtendedTimeService(PublishedAssessmentFacade publishedAssessment) {
    PublishedAssessmentService assessmentService = new PublishedAssessmentService();
    PublishedAssessmentFacade metaPublishedAssessment =
        assessmentService.getPublishedAssessmentQuick(
            publishedAssessment.getPublishedAssessmentId().toString());
    if (!assessmentInitialized(publishedAssessment)) {
      publishedAssessment = metaPublishedAssessment;
    }
    authzGroupService = ComponentManager.get(AuthzGroupService.class);

    // Grab the site id from the publishedAssessment because the user may
    // not be in a site
    // if they're taking the test via url.
    PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService();
    String pubId = publishedAssessment.getPublishedAssessmentId().toString();
    siteId = publishedAssessmentService.getPublishedAssessmentSiteId(pubId);

    this.metaString = extractMetaString(metaPublishedAssessment);
    this.hasExtendedTime = (metaString != null);
    if (this.hasExtendedTime) {
      this.timeLimit = extractExtendedTime();
      this.startDate = determineDate(1, publishedAssessment.getStartDate(), publishedAssessment);
      this.dueDate = determineDate(2, publishedAssessment.getDueDate(), publishedAssessment);
      this.retractDate =
          determineDate(3, publishedAssessment.getRetractDate(), publishedAssessment);
    } else {
      this.timeLimit = 0;
      this.startDate = publishedAssessment.getStartDate();
      this.dueDate = publishedAssessment.getDueDate();
      this.retractDate = publishedAssessment.getRetractDate();
    }
  }
Пример #2
0
 // Depending on the scope the assessment info sometimes is not initialized.
 private boolean assessmentInitialized(PublishedAssessmentFacade publishedAssessment) {
   if (publishedAssessment == null) return false;
   if (publishedAssessment.getStartDate() != null) return true;
   if (publishedAssessment.getDueDate() != null) return true;
   if (publishedAssessment.getRetractDate() != null) return true;
   if (publishedAssessment.getTimeLimit() != null) return true;
   return false;
 }