diff --git a/samigo/samigo-api/src/java/xml/author/v1p2/sectionTemplate.xml b/samigo/samigo-api/src/java/xml/author/v1p2/sectionTemplate.xml index 7b29f3034e10..6952d2991670 100644 --- a/samigo/samigo-api/src/java/xml/author/v1p2/sectionTemplate.xml +++ b/samigo/samigo-api/src/java/xml/author/v1p2/sectionTemplate.xml @@ -22,6 +22,10 @@ ATTACHMENT + + AUTHOR_TYPE + + QUESTIONS_ORDERING @@ -38,6 +42,22 @@ NUM_QUESTIONS_DRAWN + + NUM_QUESTIONS_FIXED + + + + QUESTIONS_RANDOM_DRAW_DATE + + + + QUESTIONS_FIXED_DRAW_DATE + + + + RANDOM_POOL_COUNT + + RANDOMIZATION_TYPE diff --git a/samigo/samigo-api/src/java/xml/xsl/dataTransform/import/v1p2/extractSection.xsl b/samigo/samigo-api/src/java/xml/xsl/dataTransform/import/v1p2/extractSection.xsl index 04a8526bf88b..5037d46857fe 100755 --- a/samigo/samigo-api/src/java/xml/xsl/dataTransform/import/v1p2/extractSection.xsl +++ b/samigo/samigo-api/src/java/xml/xsl/dataTransform/import/v1p2/extractSection.xsl @@ -29,26 +29,41 @@ - + + + + - + - - - - - + + + + + + + + + + + + + + + + + - + - + diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java index aa05957f8cee..6131bda7ee1c 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/asi/Section.java @@ -150,13 +150,44 @@ public void update(SectionDataIfc section) setFieldentry("SECTION_KEYWORD", section.getSectionMetaDataByLabel(SectionMetaDataIfc.KEYWORDS)); setFieldentry("SECTION_RUBRIC", section.getSectionMetaDataByLabel(SectionMetaDataIfc.RUBRICS)); setFieldentry("ATTACHMENT", getAttachment(section)); + setFieldentry("AUTHOR_TYPE", section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE)); setFieldentry("QUESTIONS_ORDERING", section.getSectionMetaDataByLabel(SectionDataIfc.QUESTIONS_ORDERING)); - setFieldentry("POOLID_FOR_RANDOM_DRAW", poolId); - setFieldentry("POOLNAME_FOR_RANDOM_DRAW", section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW)); + //setFieldentry("POOLID_FOR_RANDOM_DRAW", poolId); + //setFieldentry("POOLNAME_FOR_RANDOM_DRAW", section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW)); setFieldentry("NUM_QUESTIONS_DRAWN", section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN)); + setFieldentry("NUM_QUESTIONS_FIXED", section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_FIXED)); + setFieldentry("QUESTIONS_RANDOM_DRAW_DATE", section.getSectionMetaDataByLabel(SectionDataIfc.QUESTIONS_RANDOM_DRAW_DATE)); + setFieldentry("QUESTIONS_FIXED_DRAW_DATE", section.getSectionMetaDataByLabel(SectionDataIfc.QUESTIONS_FIXED_DRAW_DATE)); + String random_pool_count = section.getSectionMetaDataByLabel(SectionDataIfc.RANDOM_POOL_COUNT); + setFieldentry("RANDOM_POOL_COUNT", random_pool_count); setFieldentry("RANDOMIZATION_TYPE", section.getSectionMetaDataByLabel(SectionDataIfc.RANDOMIZATION_TYPE)); setFieldentry("POINT_VALUE_FOR_QUESTION", section.getSectionMetaDataByLabel(SectionDataIfc.POINT_VALUE_FOR_QUESTION)); setFieldentry("DISCOUNT_VALUE_FOR_QUESTION", section.getSectionMetaDataByLabel(SectionDataIfc.DISCOUNT_VALUE_FOR_QUESTION)); + + if (!"1".equals(random_pool_count)) { + StringBuilder poolIds = new StringBuilder(); + StringBuilder poolNames = new StringBuilder(); + + //Add the first element + poolIds.append(poolId); + String poolName = (String) section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW); + poolNames.append(poolName); + + int int_random_pool_count = Integer.parseInt(random_pool_count); + for (int i=2; i <= int_random_pool_count; i++) { + String poolIdent = (String) section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW + "_" + (i-1)); + poolName = (String) section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW + "_" + (i-1)); + poolIds.append(","); + poolNames.append(","); + poolIds.append(poolIdent); + poolNames.append(poolName); + } + setFieldentry("POOLID_FOR_RANDOM_DRAW", poolIds.toString()); + setFieldentry("POOLNAME_FOR_RANDOM_DRAW", poolNames.toString()); + } else { + setFieldentry("POOLID_FOR_RANDOM_DRAW", poolId); + setFieldentry("POOLNAME_FOR_RANDOM_DRAW", section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW)); + } // items List items = new ArrayList<>(); diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java index a951525d4594..b784a8c958c2 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/AuthoringHelper.java @@ -855,7 +855,8 @@ public SecurityAdvice isAllowed(String userId, String function, String reference if (isBasedOnQuestionPool) { QuestionPoolService questionPoolService = new QuestionPoolService(); - section.addSectionMetaData(SectionDataIfc.AUTHOR_TYPE, SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL.toString()); + String author_type = section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE); + section.addSectionMetaData(SectionDataIfc.AUTHOR_TYPE, author_type); String poolId = section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW); String poolTitle = section.getSectionMetaDataByLabel(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW); boolean hasRandomPartScore = false; diff --git a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java index e308db6e4aec..a5d83b18f589 100755 --- a/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java +++ b/samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java @@ -1504,6 +1504,7 @@ public void updateSection(SectionFacade section, Map sectionMap) section.addSectionMetaData(SectionMetaDataIfc.KEYWORDS, (String) sectionMap.get("keyword")); section.addSectionMetaData(SectionMetaDataIfc.OBJECTIVES, (String) sectionMap.get("objective")); section.addSectionMetaData(SectionMetaDataIfc.RUBRICS, (String) sectionMap.get("rubric")); + section.addSectionMetaData(SectionDataIfc.AUTHOR_TYPE, (String) sectionMap.get("author_type")); // SAM-2781: if you are importing from before Sakai 11, this will be null String qorderString = (String) sectionMap.get("questions-ordering"); @@ -3251,9 +3252,29 @@ private Set makeEMIItemTextAttachmentSet(ItemText itemTex public boolean updateSectionBasedOnQuestionPool(SectionFacade section, Map sectionMap) { - section.addSectionMetaData(SectionDataIfc.POOLID_FOR_RANDOM_DRAW, (String)sectionMap.get("pool_id")); - section.addSectionMetaData(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW, (String)sectionMap.get("pool_name")); - section.addSectionMetaData(SectionDataIfc.NUM_QUESTIONS_DRAWN, (String)sectionMap.get("num_questions")); + String random_pool_count = (String)sectionMap.get("random_pool_count"); + section.addSectionMetaData(SectionDataIfc.AUTHOR_TYPE, (String)sectionMap.get("author_type")); + section.addSectionMetaData(SectionDataIfc.RANDOM_POOL_COUNT, random_pool_count); + + if (!"1".equals(random_pool_count)) { + int int_random_pool_count = Integer.parseInt(random_pool_count); + for (int i=2; i < int_random_pool_count; i++) { + //String poolId = (String) sectionMap.get("POOLID_FOR_RANDOM_DRAW_" + i-1); + //String poolName = (String) sectionMap.get("POOLNAME_FOR_RANDOM_DRAW_" + i-1); + } + section.addSectionMetaData(SectionDataIfc.POOLID_FOR_RANDOM_DRAW, (String)sectionMap.get("pool_id")); + section.addSectionMetaData(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW, (String)sectionMap.get("pool_name")); + } + + else { + section.addSectionMetaData(SectionDataIfc.POOLID_FOR_RANDOM_DRAW, (String)sectionMap.get("pool_id")); + section.addSectionMetaData(SectionDataIfc.POOLNAME_FOR_RANDOM_DRAW, (String)sectionMap.get("pool_name")); + } + section.addSectionMetaData(SectionDataIfc.NUM_QUESTIONS_DRAWN, (String)sectionMap.get("num_questions_drawn")); + section.addSectionMetaData(SectionDataIfc.NUM_QUESTIONS_FIXED, (String)sectionMap.get("num_questions_fixed")); + section.addSectionMetaData(SectionDataIfc.QUESTIONS_RANDOM_DRAW_DATE, (String)sectionMap.get("questions_random_draw_date")); + section.addSectionMetaData(SectionDataIfc.QUESTIONS_FIXED_DRAW_DATE, (String)sectionMap.get("questions_fixed_draw_date")); + section.addSectionMetaData(SectionDataIfc.RANDOMIZATION_TYPE, (String)sectionMap.get("randomization_type")); section.addSectionMetaData(SectionDataIfc.POINT_VALUE_FOR_QUESTION, (String)sectionMap.get("point_value")); section.addSectionMetaData(SectionDataIfc.DISCOUNT_VALUE_FOR_QUESTION, (String)sectionMap.get("discount_value")); diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java index d8019a2de0dd..d18c5c097098 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/SectionFacade.java @@ -574,6 +574,8 @@ public void addSectionMetaData(String label, String entry) { } if (this.metaDataMap.containsKey(label)) { + // Update the map too + this.metaDataMap.put(label, entry); // just update Iterator iter = this.metaDataSet.iterator(); while (iter.hasNext()){ diff --git a/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java b/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java index 9d3a6901df95..e2419611dd17 100644 --- a/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java +++ b/samigo/samlite-impl/src/java/org/sakaiproject/tool/assessment/samlite/impl/SamLiteServiceImpl.java @@ -464,6 +464,7 @@ public QuestestinteropDocument createQTIDocument(QuestionGroup questionGroup) { buildMetaDataField(sectionMetaData, "SECTION_OBJECTIVE", ""); buildMetaDataField(sectionMetaData, "SECTION_KEYWORD", ""); buildMetaDataField(sectionMetaData, "SECTION_RUBRIC", ""); + buildMetaDataField(sectionMetaData, "AUTHOR_TYPE", ""); PresentationMaterialType sectionPresentationMaterial = section.addNewPresentationMaterial(); FlowMatType spFlowMat = sectionPresentationMaterial.addNewFlowMat();