コード例 #1
0
  public void setQuestionSizeAndTotalScore() {
    this.questionSize = 0;
    this.totalScore = 0;
    int randomPartCount = 0;

    AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");

    for (int i = 0; i < this.sections.size(); i++) {
      SectionContentsBean sectionBean = (SectionContentsBean) sections.get(i);
      ArrayList items = sectionBean.getItemContents();

      int itemsInThisSection = 0;
      if (sectionBean.getSectionAuthorType().equals(SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL)) {
        // for random draw parts, add
        randomPartCount++;
        itemsInThisSection = sectionBean.getNumberToBeDrawn().intValue();
      } else {
        itemsInThisSection = items.size();
      }

      this.questionSize += itemsInThisSection;
      for (int j = 0; j < itemsInThisSection; j++) {
        ItemContentsBean item = (ItemContentsBean) items.get(j);
        if (item.getItemData().getScore() != null) {
          this.totalScore += item.getItemData().getScore().doubleValue();
        }
      }
    }
    if (randomPartCount > 0) {
      setHasRandomDrawPart(true);
    } else {
      setHasRandomDrawPart(false);
    }
  }
コード例 #2
0
 private void buildItemContentsMap(DeliveryBean dbean) {
   HashMap itemContentsMap = new HashMap();
   ArrayList partsContents = dbean.getPageContents().getPartsContents();
   if (partsContents != null) {
     Iterator iter = partsContents.iterator();
     while (iter.hasNext()) {
       SectionContentsBean sectionContentsBean = (SectionContentsBean) iter.next();
       if (sectionContentsBean != null) {
         ArrayList itemContents = sectionContentsBean.getItemContents();
         Iterator iter2 = itemContents.iterator();
         while (iter2.hasNext()) {
           ItemContentsBean itemContentsBean = (ItemContentsBean) iter2.next();
           if (itemContentsBean != null) {
             List<ItemGradingData> itemGradingDataArray =
                 itemContentsBean.getItemGradingDataArray();
             Iterator<ItemGradingData> iter3 = itemGradingDataArray.iterator();
             while (iter3.hasNext()) {
               ItemGradingData itemGradingData = iter3.next();
               itemContentsMap.put(itemGradingData.getItemGradingId(), itemContentsBean);
             }
           }
         }
       }
     }
   }
   dbean.setItemContentsMap(itemContentsMap);
 }
コード例 #3
0
  /**
   * This will populate the StudentScoresBean with the data associated with the particular versioned
   * assessment based on the publishedId.
   *
   * @param publishedId String
   * @param bean StudentScoresBean
   * @return boolean
   */
  public boolean studentScores(String publishedId, StudentScoresBean bean, boolean isValueChange) {
    log.debug("studentScores()");
    try {
      //  SAK-4121, do not pass studentName as f:param, will cause javascript error if name contains
      // apostrophe
      //    bean.setStudentName(cu.lookupParam("studentName"));

      bean.setPublishedId(publishedId);
      String studentId = ContextUtil.lookupParam("studentid");
      bean.setStudentId(studentId);
      AgentFacade agent = new AgentFacade(studentId);
      bean.setStudentName(agent.getFirstName() + " " + agent.getLastName());
      bean.setLastName(agent.getLastName());
      bean.setFirstName(agent.getFirstName());
      bean.setAssessmentGradingId(ContextUtil.lookupParam("gradingData"));
      bean.setItemId(ContextUtil.lookupParam("itemId"));
      bean.setEmail(agent.getEmail());

      DeliveryBean dbean = (DeliveryBean) ContextUtil.lookupBean("delivery");
      dbean.setActionString("gradeAssessment");

      DeliveryActionListener listener = new DeliveryActionListener();
      listener.processAction(null);

      // Added for SAK-13930
      DeliveryBean updatedDeliveryBean = (DeliveryBean) ContextUtil.lookupBean("delivery");
      ArrayList parts = updatedDeliveryBean.getPageContents().getPartsContents();
      Iterator iter = parts.iterator();
      while (iter.hasNext()) {
        ArrayList items = ((SectionContentsBean) iter.next()).getItemContents();
        Iterator iter2 = items.iterator();
        while (iter2.hasNext()) {
          ItemContentsBean question = (ItemContentsBean) iter2.next();
          if (question.getGradingComment() != null && !question.getGradingComment().equals("")) {
            question.setGradingComment(
                FormattedText.convertFormattedTextToPlaintext(question.getGradingComment()));
          }
        }
      } // End of SAK-13930

      GradingService service = new GradingService();
      AssessmentGradingData adata =
          (AssessmentGradingData) service.load(bean.getAssessmentGradingId(), false);
      bean.setComments(FormattedText.convertFormattedTextToPlaintext(adata.getComments()));
      buildItemContentsMap(dbean);

      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }