Example #1
0
        public void GetQuizReports(string sco_id)
        {
            //NOTE: transactions are not available for quizzes (ref. to quizreport viewer)

            /*
             * bool isQuiz = true;
             * if (!isQuiz)
             * {
             *  string s_login = "******";
             *  XmlNodeList rNodes = m_acConn.Report_QuizTakers(ScoId, string.Empty, out sInfo);
             *  //TransactionInfo[] tInfo = acConn.Report_ConsolidatedTransactions("filter-gt-date-created=2008-01-01", out sInfo);
             *  DateTime refDate = DateTime.UtcNow.AddMonths(-2);
             *  string dateFrom = string.Format("{0}-{1}-01", refDate.Year, refDate.Month);
             *  TransactionInfo[] tInfo = m_acConn.Report_ConsolidatedTransactions(string.Format("filter-Login={0}&filter-gt-date-created={1}", s_login, dateFrom), out sInfo);
             *
             *  ReportHelper report = new ReportHelper(tInfo, m_acConn);
             *  ReportHelper.QuizResult[] qResults = m_acConn.GetQuizResultsByAttendee(s_login);
             *  DumpResultsCSV(qResults, s_login);
             * }
             * else
             */
            {
                //rNodes:
                //transcript-id sco-id principal-id status score max-score asset-id permission-id attempts time-taken certificate answered-survey version
                //1. Report_QuizTakers => transcript-id, sco-id, principal-id, Name, principal_name, Login, date_created
                XmlNodeList rNodes  = m_acConn.Report_QuizTakers(sco_id, string.Empty, out sInfo);
                DataTable   qTakers = GetDataTable(rNodes);
                rNodes = null;

                //2. QuizIteractions => transcript-id interaction-id sco-id, question Name
                rNodes = m_acConn.Report_QuizInteractions(sco_id, string.Empty, out sInfo);
                DataTable qInteractions = GetDataTable(rNodes);
                rNodes = null;

                //3. QuizQuestionDistribution => interaction-id num-correct num-incorrect total-responses percentage-correct score
                rNodes = m_acConn.Report_QuizQuestionDistribution(sco_id, string.Empty, out sInfo);
                DataTable qQuestionDistribution = GetDataTable(rNodes);
                rNodes = null;

                //out: ScoId, PrincipalID, num-correct num-incorrect total-responses percentage-correct score

                if (qTakers != null)
                {
                    DumpResultsCSV(qTakers, "QuizTakers_" + sco_id, null);
                }
                else
                {
                    Console.WriteLine("QuizTakers: no data available.");
                }
                if (qInteractions != null)
                {
                    DumpResultsCSV(qInteractions, "qInteractions_" + sco_id, null);
                }
                else
                {
                    Console.WriteLine("qInteractions: no data available.");
                }
                if (qQuestionDistribution != null)
                {
                    DumpResultsCSV(qQuestionDistribution, "qQuestionDistribution_" + sco_id, null);
                }
                else
                {
                    Console.WriteLine("qQuestionDistribution: no data available.");
                }
            }
        }