public void ApplyDefaultChapterSequencing() { var seq = new Sequencing(); SequencingPatternManager.ApplyDefaultChapterSequencing(seq); Assert.AreEqual(seq.ControlMode.Flow, true); Assert.AreEqual(seq.ControlMode.Choice, true); }
public void ApplyRandomSetSequencingPattern() { var seq = new Sequencing(); const int count = 10; SequencingPatternManager.ApplyRandomSetSequencingPattern(seq, count); Assert.AreEqual(seq.RandomizationControls.ReorderChildren, true); Assert.AreEqual(seq.RandomizationControls.SelectionTiming, Timing.Once); Assert.AreEqual(seq.RandomizationControls.SelectCount, count); }
public static Sequencing ApplyDefaultChapterSequencing(Sequencing sequencing) { if (sequencing.ControlMode == null) { sequencing.ControlMode = new ControlMode(); } sequencing.ControlMode.Choice = true; sequencing.ControlMode.Flow = true; return sequencing; }
public static Sequencing ApplyDefaultChapterSequencing(Sequencing sequencing) { sequencing.ControlMode = new ControlMode(); sequencing.LimitConditions = null; sequencing.RandomizationControls = null; sequencing.ControlMode.Choice = true; sequencing.ControlMode.Flow = true; return sequencing; }
public void ApplyControlChapterSequencing() { var seq = new Sequencing(); SequencingPatternManager.ApplyControlChapterSequencing(seq); Assert.AreEqual(seq.ControlMode.Choice, false); Assert.AreEqual(seq.ControlMode.Flow, true); Assert.AreEqual(seq.ControlMode.ForwardOnly, true); Assert.AreEqual(seq.ControlMode.ChoiceExit, false); Assert.AreEqual(seq.LimitConditions.AttemptLimit, 1); }
public static Sequencing ApplyRandomSetSequencingPattern(Sequencing sequencing, int selectCount) { if (sequencing.RandomizationControls == null) { sequencing.RandomizationControls = new RandomizationControls(); } sequencing.RandomizationControls.ReorderChildren = true; sequencing.RandomizationControls.SelectionTiming = Timing.Once; sequencing.RandomizationControls.SelectCount = selectCount; return sequencing; }
public static Sequencing ApplyControlChapterSequencing(Sequencing sequencing) { sequencing.ControlMode = new ControlMode(); sequencing.LimitConditions = new LimitConditions(); sequencing.RandomizationControls = null; sequencing.ControlMode.Choice = false; sequencing.ControlMode.Flow = true; sequencing.ControlMode.ForwardOnly = true; sequencing.ControlMode.ChoiceExit = false; sequencing.LimitConditions.AttemptLimit = 1; return sequencing; }
public virtual void Parse(int courseId) { var db = this.GetDbContext(); var course = db.Courses.Single(c => c.Id == courseId); if (!course.Locked.Value) { return; } var coursePath = this.GetCoursePath(course.Id); var courseTempPath = this.GetCourseTempPath(course.Id); var manifestPath = Path.Combine(courseTempPath, SCORM.ImsManifset); Zipper.ExtractZipFile(coursePath + ".zip", courseTempPath); var manifest = Manifest.Deserialize(manifestPath); var importer = new Importer(manifest, course, this); importer.Import(); // QUICK FIX for importing images var imagesPath = Path.Combine(courseTempPath, "Node"); if (Directory.Exists(imagesPath)) { FileHelper.DirectoryCopy(imagesPath, Path.Combine(coursePath, "Node")); } // QUICK FIX for "Row not found or changed." exception db = this.GetDbContext(); course = db.Courses.Single(c => c.Id == courseId); course.Locked = false; var xml = new XmlSerializer(typeof(Sequencing)); // try to apply sequencing from imported course try { var sequencing = manifest.SequencingCollection.Sequencings[0]; course.Sequencing = xml.SerializeToXElemet(sequencing); } catch (Exception) // apply default sequencing if any errors occured { var sequencing = new Sequencing(); sequencing = SequencingPatternManager.ApplyDefaultChapterSequencing(sequencing); course.Sequencing = xml.SerializeToXElemet(sequencing); } db.SubmitChanges(); }
public void SequencingTest() { var sequencing = new Sequencing(); sequencing.AdlObjectives = new AdlObjectives(); sequencing.AdlObjectives.Objectives = new List<AdlObjective>(); sequencing.AuxiliaryResources = "res"; sequencing.ConstrainedChoiceConsiderations = new ConstrainedChoiceConsiderations { ConstrainChoice = true, CourseId = 1, NodeId = 2, PreventActivation = false, Type = "type" }; sequencing.ControlMode = new ControlMode { Choice = true, ChoiceExit = false, CourseId = 1, Flow = false, ForwardOnly = false, NodeId = 2, Type = "type", UseCurrentAttemptObjectiveInfo = false, UseCurrentAttemptProgressInfo = true }; sequencing.DeliveryControls = new DeliveryControls { CompletionSetByContent = true, CourseId = 1, NodeId = 2, ObjectiveSetByContent = false, Tracked = false, Type = "type" }; sequencing.Id = "id"; sequencing.IdRef = "ref"; sequencing.LimitConditions = new LimitConditions { AttemptAbsoluteDurationLimit = "1", AttemptLimit = 0, CourseId = 1, NodeId = 2, Type = "type" }; sequencing.Objectives = new Objectives(); sequencing.RandomizationControls = new RandomizationControls { CourseId = 1, NodeId = 2, RandomizationTiming = Timing.Once, ReorderChildren = true, SelectCount = 1, SelectionTiming = Timing.Never }; sequencing.RollupConsiderations = new RollupConsiderations { CourseId = 1, NodeId = 2, MeasureSatisfactionIfActive = false, RequiredForCompleted = Required.IfNotSkipped, RequiredForIncomplete = Required.IfNotSuspended, RequiredForNotSatisfied = Required.Always, RequiredForSatisfied = Required.IfAttempted, Type = "type", }; sequencing.RollupRules = new RollupRules { CourseId = 1, NodeId = 2, ObjectiveMeasureWeight = 1, RollupObjectiveSatisfied = false, RollupProgressCompletion = true, RollupRulesList = new List<RollupRule>() }; sequencing.SequencingRules = new SequencingRules { ExitConditionRule = new Rule { RuleAction = new RuleAction { Action = Action.Previous }, RuleConditions = new RuleConditions { ConditionCombination = ConditionCombination.All, RuleConditionsList = new List<RuleCondition>() } } }; var rule = new RollupRule { ChildActivitySet = ChildActivitySet.All, CourseId = 1, NodeId = 2, Type = "type", MinimumCount = 1, MinimumPercent = 1, RollupAction = new RollupAction { Action = RollupActions.Completed } }; var con = new RollupConsiderations { CourseId = 1, NodeId = 2, MeasureSatisfactionIfActive = false, RequiredForCompleted = Required.Always, RequiredForIncomplete = Required.IfNotSkipped, RequiredForNotSatisfied = Required.IfNotSkipped, RequiredForSatisfied = Required.IfAttempted, Type = "type" }; sequencing.RollupConsiderations = con; sequencing.RollupRules = new RollupRules { CourseId = 1, NodeId = 2, ObjectiveMeasureWeight = 1, RollupObjectiveSatisfied = false, RollupProgressCompletion = true, RollupRulesList = new List<RollupRule>() }; sequencing.RollupRules.RollupRulesList.Add(rule); var manifest = new Manifest(); manifest.SequencingCollection = new SequencingCollection(); manifest.SequencingCollection.Sequencings = new List<Sequencing>(); manifest.SequencingCollection.Sequencings.Add(sequencing); var path = Path.Combine(this.root, "sequencing.xml"); manifest.Serialize(new StreamWriter(path)); Assert.IsTrue(File.Exists(path)); }