Example #1
0
        private static void QMLsAssociatedToQuestionId(IAuthoringApiExamples examples)
        {
            ShowTitle("QMLs associated to QuestionId");
            var qmls = examples.GetQMLsByQuestionId(QuestionId_of_Assessment_with_MultipleLanguages);

            foreach (var qml in qmls)
            {
                Console.WriteLine(qml);
            }

            PromptContinue();
        }
Example #2
0
        private static void AssessmentAMLsWitTheGivenAssessmentRevisionId(IAuthoringApiExamples examples)
        {
            ShowTitle("AssessmentAMLs with the given AssessmentRevisionId");
            var assessmentAMLsOfRevisionId = examples.GetAssessmentAMLsByAssessmentRevisionId(AssessmentRevisionId_of_Assessment_with_MultipleAssessmentQML);

            foreach (var assessmentAMLs in assessmentAMLsOfRevisionId)
            {
                Console.WriteLine($" AssessmentRevisionID: {assessmentAMLs.AssessmentRevisionId} - Language: {assessmentAMLs.Language}");
            }

            PromptContinue();
        }
Example #3
0
        private static void GetAssessmentNamesIteratingThroughEachPage(IAuthoringApiExamples examples)
        {
            ShowTitle("Assessment Names iterating through each page");
            var assessmentNames = examples.GetAllAssessmentNamesIteratingEachAvailablePage();

            foreach (var name in assessmentNames)
            {
                Console.WriteLine($" Assessment Name: {name}");
            }

            PromptContinue();
        }
Example #4
0
        private static void GetAllQMLForAssessment(IAuthoringApiExamples examples)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            ShowTitle("Get all QML belonging to Assessment");

            ShowProgress("1) Get AML ");
            var aml = examples.GetAMLByAssessmentRevisionIdAndLanguage(AssessmentRevisionId_of_Assessment_with_Multiple_QuestionBlocks, Language_of_Assessment_with_Multiple_QuestionBlocks);

            Console.WriteLine(aml);

            ShowProgress("2) Parse AML to get topics and questions ");
            List <int>  topics;
            List <int>  topicsWithSubTopics;
            List <long> questionIds;

            AMLHelper.GetTopicsAndQuestionsFromAML(aml, out topics, out topicsWithSubTopics, out questionIds);
            Console.WriteLine($"    - Topics: {String.Join(",", topics)}");
            Console.WriteLine($"    - Topics with sub topics: {String.Join(",", topicsWithSubTopics)}");
            Console.WriteLine($"    - Questions: {String.Join(",", questionIds)}");

            ShowProgress("3) Get all sub topics needed ");
            foreach (var topic in topicsWithSubTopics)
            {
                var subTopicIds = examples.GetSubTopicsIdOfTopic(topic);
                foreach (var subTopicId in subTopicIds)
                {
                    if (topics.Contains(subTopicId))
                    {
                        continue;
                    }
                    topics.Add(subTopicId);
                }
            }
            Console.WriteLine($"    - All Topics: {String.Join(",", topics)}");

            ShowProgress("4) Get all latest Question Revisions in topics ");
            var questionRevisions = new List <QuestionRevision>();

            foreach (var topicId in topics)
            {
                questionRevisions.AddRange(examples.GetLatestQuestionRevisionsByTopicPublishedId(topicId));
            }
            Console.WriteLine($"    - QuestionRevisions: {String.Join(",", questionRevisions.Select(qr => $"{qr.Id}/{qr.Language}/{qr.QuestionId}"))}");

            ShowProgress("5) Remove duplicated QuestionId ");
            questionIds.RemoveAll(q => questionRevisions.Select(qr => qr.QuestionId).Contains(q));
            Console.WriteLine($"    - QuestionIds after removing duplicates: {String.Join(",", questionIds)}");

            ShowProgress("6) Get all latest Question Revisions by QuestionId ");
            foreach (var questionId in questionIds)
            {
                var questionRevisionsForQuestionId = examples.GetLatestQuestionRevisionsByQuestionId(questionId);
                foreach (var questionRevisionForQuestionId in questionRevisionsForQuestionId)
                {
                    if (questionRevisions.Select(qr => qr.QuestionId).Contains(questionRevisionForQuestionId.QuestionId))
                    {
                        continue;
                    }
                    questionRevisions.Add(questionRevisionForQuestionId);
                }
            }

            ShowProgress("7) Get QML for each Question Revision");
            foreach (var questionRevision in questionRevisions)
            {
                var qml = examples.GetQMLByQuestionRevisionIdAndLanguage(questionRevision.Id, questionRevision.Language);
                Console.WriteLine($"    - QML Found:");
                Console.WriteLine(qml);
            }

            stopWatch.Stop();
            ShowTitle($"Completed in: {stopWatch.ElapsedMilliseconds} ms");

            PromptContinue();
        }
Example #5
0
        private static void AssessmentRevisionWithGivenAssessmentRevisionIdAndLanguage(IAuthoringApiExamples examples)
        {
            ShowTitle("AssessmentRevision with the given AssessmentRevisionId and Language");
            var assessmentRevisionByKey = examples.GetAssessmentRevisionById(AssessmentRevisionId_of_Assessment_with_MultipleAssessmentQML);

            Console.WriteLine($" AssessmentRevisionID: {assessmentRevisionByKey.Id} - Language: {assessmentRevisionByKey.Language} - AssessmentName: {assessmentRevisionByKey.AssessmentName}");

            PromptContinue();
        }