예제 #1
0
 public static IEnumerable <XElement> Construct(IList <Item> items,
                                                XElement itemPool, Assessment assessment)
 {
     // Each language will get its own test form, but they will be identical
     return(itemPool.XPathSelectElements("//poolproperty")
            .Where(x => x.Attribute("property").Value.Equals("Language", StringComparison.OrdinalIgnoreCase))
            .Select(x => x.Attribute("value").Value)
            .Distinct().ToList().Select(x =>
                                        new XElement("testform",
                                                     new XAttribute("length", items.Count().ToString()),
                                                     new XElement("identifier",
                                                                  new XAttribute("uniqueid", $"{assessment.UniqueId}:Default-{x}"),
                                                                  new XAttribute("name", $"{assessment.UniqueId}:Default-{x}"),
                                                                  new XAttribute("version", "1")),
                                                     new XElement("property",
                                                                  new XAttribute("name", "language"),
                                                                  new XAttribute("value", x),
                                                                  new XAttribute("label", x)),
                                                     new XElement("poolproperty",
                                                                  new XAttribute("property", "Language"),
                                                                  new XAttribute("value", x),
                                                                  new XAttribute("label", x),
                                                                  new XAttribute("itemcount", items.Count().ToString())),
                                                     PoolPropertyUtilities.GeneratePoolPropertyTypes(itemPool),
                                                     FormPartition.Construct(items, itemPool, assessment))));
 }
        public static IEnumerable <XElement> Construct()
        {
            var result        = new List <XElement>();
            var scoringRules  = ScoringRules.Construct(ExtractionSettings.AssessmentScoring);
            var itemPool      = ItemPool.Construct(ExtractionSettings.ItemInput, ExtractionSettings.AssessmentInfo.Publisher);
            var testBlueprint = TestBlueprint.Construct(ExtractionSettings.ItemInput, itemPool,
                                                        ExtractionSettings.AssessmentInfo.UniqueId);
            var testForms = TestForm.Construct(ExtractionSettings.ItemInput, itemPool,
                                               ExtractionSettings.AssessmentInfo).ToList();
            var performanceLevels = PerformanceLevels.Construct(ExtractionSettings.AssessmentInfo);
            var adminSegments     = AdminSegment.Construct(itemPool, ExtractionSettings.ItemInput);

            var scoringSpecification = BuildGlobalProperties("scoring");

            scoringSpecification.Add(new XElement("scoring",
                                                  testBlueprint,
                                                  itemPool,
                                                  testForms,
                                                  performanceLevels,
                                                  scoringRules
                                                  ));
            result.Add(scoringSpecification);

            var administrationSpecification = BuildGlobalProperties("administration");

            administrationSpecification.Add(new XElement("administration",
                                                         testBlueprint,
                                                         PoolPropertyUtilities.GeneratePoolPropertyTypes(itemPool),
                                                         PoolPropertyUtilities.GeneratePoolPropertyLanguages(itemPool),
                                                         itemPool,
                                                         testForms,
                                                         adminSegments));
            result.Add(administrationSpecification);

            return(result);
        }