Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-50121 Samigo exporting and then importing a test removes option 'Random draw from multiple question pools' #12869

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions samigo/samigo-api/src/java/xml/author/v1p2/sectionTemplate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<fieldlabel>ATTACHMENT</fieldlabel>
<fieldentry/>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>AUTHOR_TYPE</fieldlabel>
<fieldentry/>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>QUESTIONS_ORDERING</fieldlabel>
<fieldentry/>
Expand All @@ -38,6 +42,22 @@
<fieldlabel>NUM_QUESTIONS_DRAWN</fieldlabel>
<fieldentry/>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>NUM_QUESTIONS_FIXED</fieldlabel>
<fieldentry/>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>QUESTIONS_RANDOM_DRAW_DATE</fieldlabel>
<fieldentry/>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>QUESTIONS_FIXED_DRAW_DATE</fieldlabel>
<fieldentry/>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>RANDOM_POOL_COUNT</fieldlabel>
<fieldentry/>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>RANDOMIZATION_TYPE</fieldlabel>
<fieldentry/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,41 @@
<attachment>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[5]/fieldentry"/>
</attachment>
<questions-ordering>
<author_type>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[6]/fieldentry"/>
</author_type>
<questions-ordering>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[7]/fieldentry"/>
</questions-ordering>
<pool_id>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[7]/fieldentry"/>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[8]/fieldentry"/>
</pool_id>
<pool_name>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[8]/fieldentry"/>
</pool_name>
<num_questions>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[9]/fieldentry"/>
</num_questions>
<randomization_type>
</pool_name>
<num_questions_drawn>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[10]/fieldentry"/>
</num_questions_drawn>
<num_questions_fixed>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[11]/fieldentry"/>
</num_questions_fixed>
<questions_random_draw_date>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[12]/fieldentry"/>
</questions_random_draw_date>
<questions_fixed_draw_date>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[13]/fieldentry"/>
</questions_fixed_draw_date>
<random_pool_count>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[14]/fieldentry"/>
</random_pool_count>
<randomization_type>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[15]/fieldentry"/>
</randomization_type>
<point_value>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[11]/fieldentry"/>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[16]/fieldentry"/>
</point_value>
<discount_value>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[12]/fieldentry"/>
<xsl:value-of select="//section/qtimetadata/qtimetadatafield[17]/fieldentry"/>
</discount_value>
</sectionData>
</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,15 @@ 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("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));
setFieldentry("RANDOM_POOL_COUNT", section.getSectionMetaDataByLabel(SectionDataIfc.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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -3251,9 +3252,14 @@ private Set<ItemTextAttachmentIfc> makeEMIItemTextAttachmentSet(ItemText itemTex

public boolean updateSectionBasedOnQuestionPool(SectionFacade section, Map sectionMap) {

section.addSectionMetaData(SectionDataIfc.AUTHOR_TYPE, (String)sectionMap.get("author_type"));
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"));
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.RANDOM_POOL_COUNT, (String)sectionMap.get("random_pool_count"));
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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading