Пример #1
0
        public void GetSections_SimulateClassScheduleApplication()
        {
            // Simulates actual call from Online Class Schedule application - which passes extra
            IList <ISectionFacet> facets = TestHelper.GetFacets(new ModalityFacet(ModalityFacet.Options.Online));

            facets.Add(new TimeFacet(new TimeSpan(0, 0, 0), new TimeSpan(23, 59, 0)));
            facets.Add(new DaysFacet(DaysFacet.Options.All));

            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                string          subject  = TestHelper.Data.CourseSubjectOfferedEveryQuarter;
                IList <Section> sections = repository.GetSections(subject, yrq, facets);

                int count = sections.Count;
                Assert.IsTrue(count > 0, "No records returned.");

                int expectedSectionCount = _dataVerifier.GetSectionCount(string.Format("(CourseID like '{0}%' and SBCTCMisc1 like '3%' and YearQuarterID = '{1}')", subject, yrq.ID));
                Assert.AreEqual(expectedSectionCount, count);

                int allSectionCount = _dataVerifier.GetSectionCount("not ClassID is null");
                Assert.IsTrue(allSectionCount > count, "Query failed: ALL records were returned.");
            }
        }
Пример #2
0
        public void GetSections_Fall2011_OnCampus_WideTimeRange()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                TimeSpan startTime = new TimeSpan(2, 55, 0);
                TimeSpan endTime   = new TimeSpan(22, 55, 0);

                IList <ISectionFacet> facets = new List <ISectionFacet>();
                facets.Add(new TimeFacet(startTime, endTime));
                facets.Add(new ModalityFacet(ModalityFacet.Options.OnCampus));
                facets.Add(new AvailabilityFacet(AvailabilityFacet.Options.All));

                string subject = null;

//				IList<Section> sections = repository.GetSections(subject, YearQuarter.FromString("B122"), facets);
                IList <Section> sections = repository.GetSections(YearQuarter.FromString("B122"), facets);
                Assert.IsTrue(sections.Count > 0, "No sections were returned");

                // make sure we have sections that fall in the specified range...
                int rightSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) >= 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) <= 0)).Count() > 0).Count();
                Assert.IsTrue(rightSectionCount > 0, "Section records do not include start/end times in the specified range.");

                // ... and that we don't have any that fall outside that range
                int wrongSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) < 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) > 0)).Count() > 0).Count();
                Assert.IsTrue(wrongSectionCount <= 0, "Found {0} sections with start/end times outside of {1} - {2}", wrongSectionCount, startTime, endTime);
            }
        }
        public void GetSectionsByCourseID_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(CourseID.FromString("ART 101"), facetOptions: TestHelper.GetFacets());

                Assert.IsTrue(sections.Count > 0);
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="facet"></param>
        /// <param name="includeQuarterFilter"></param>
        /// <returns></returns>
        static public IList <Section> GetSectionsWithFilter(ISectionFacet facet, bool includeQuarterFilter = true)
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <ISectionFacet> facets = GetFacets(facet, includeQuarterFilter);

                return(repository.GetSections(facets));
            }
        }
        public void GetSectionsByCourseID_WithYrq_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter     yrq      = YearQuarter.FromString("B012");
                IList <Section> sections = repository.GetSections(CourseID.FromString("ART 101"), yrq);

                Assert.IsTrue(sections.Count > 0);
            }
        }
        public void GetSections_VerifyCommonCourseCharacterRemovedFromCourseID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections("ENGL", YearQuarter.FromString("B122"));

                int count = sections.Where(s => s.CourseID.Contains("&")).Count();
                Assert.IsTrue(count == 0, "{0} records found to still contain the CCN character ('&') in the CourseID", count);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="excludedSection"></param>
        private void AssertExcludedSection(string excludedSection)
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No Sections were returned.");

                int count = sections.Where(s => s.ID.ToString() == excludedSection).Count();
                Assert.IsTrue(count <= 0, "Sections collection contains a record that should be filtered out: ({0})", excludedSection);
            }
        }
        public void GetSectionsBySubject_WithQuarterFilter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter     yrq      = YearQuarter.FromString("B122");
                IList <Section> sections = repository.GetSections("ENGL", yrq);
                int             count    = sections.Where(s => s.Yrq.ID == "B122" && s.CourseID.StartsWith("ENGL")).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_VerifyCourseDescriptions()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0);

                IEnumerable <Section> withNonNullDesc = sections.Where(s => s.CourseDescriptions != null && s.CourseDescriptions.Count > 0);
                Assert.IsTrue(withNonNullDesc.Count() > 0, "All CourseDescriptions properties are null");
            }
        }
        public void GetSections_ByClassIDCollection_Success()
        {
            int sectionCount       = 3;
            IList <ISectionID> ids = _dataVerifier.GetSectionIDListFromQuery("english", sectionCount);

            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(ids, TestHelper.GetFacets());

                Assert.AreEqual(sectionCount, sections.Count);
            }
        }
        public void GetSections_VerifyWaitlist()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(TestHelper.GetFacets());

                int actualSectionCount   = sections.Where(s => s.WaitlistCount > 0).Count();
                int expectedSectionCount = _dataVerifier.GetSectionCount("ClassID in (select w.ClassID from vw_Waitlist w where w.[Status] = 'W-LISTED')");

                Assert.AreEqual(expectedSectionCount, actualSectionCount);
            }
        }
        public void GetSectionsByYearQuarter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                string      yearQuarterId = "B012";
                YearQuarter yrq           = YearQuarter.FromString(yearQuarterId);

                IList <Section> sections = repository.GetSections(yrq);
                int             count    = sections.Where(s => s.Yrq.ID == yearQuarterId).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_ByCourseIDCollection_Success()
        {
            IList <ICourseID> ids = _dataVerifier.GetCourseIDListFromQuery("stud", 3);
            int expectedCount     = ids.Count;

            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections     = repository.GetSections(ids, facetOptions: TestHelper.GetFacets());
                int             sectionCount = sections.Count;

                Assert.IsTrue(expectedCount <= sectionCount, "Sections returned ({0}) is less than # of CourseIDs ({1})", sectionCount, expectedCount);
            }
        }
//		[Conditional("BC_ONLY")]
        public void GetSectionsByCourseID_WithYrq_VerifyInstructorEmail()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq      = YearQuarter.FromString("B233");
                string      courseId = "ART 101";

                IList <Section> sections = repository.GetSections(CourseID.FromString(courseId), yrq, TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No sections found for {0} in {1}", courseId, yrq.FriendlyName);

                int emailCount = sections.Where(s => s.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorEmail)).Count() > 0).Count();
                Assert.IsTrue(emailCount > 0, "No instructor e-mails found.");
            }
        }
        public void GetSections_VerifyIsLinkedClasses()
        {
            IList <ISectionFacet> facets = TestHelper.GetFacets();

            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(facets);

                int expected = _dataVerifier.GetSectionCount("isnull(ItemYRQLink, '') <> '' and ItemYRQLink <> ItemNumber");
                int actual   = sections.Where(s => s.IsLinked).Count();

                Assert.AreEqual(expected, actual);
            }
        }
        public void GetSections_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(TestHelper.GetFacets());

                /* Additional Debugging
                 * string yrq = "B233";
                 * string[] ins = {"3468", "3472"};
                 * IEnumerable<Section> sec = sections.Where(s => ins.Contains(s.ID.ItemNumber) && s.ID.YearQuarter == yrq);
                 * // */

                Assert.IsTrue(sections.Count > 0);
            }
        }
        public void GetSectionsBySubject_WithQuarterFilter_OnCampus_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter           yrq    = YearQuarter.FromString("B122");
                IList <ISectionFacet> facets = new List <ISectionFacet>(1);
                facets.Add(new ModalityFacet(ModalityFacet.Options.OnCampus));

                IList <Section> sections = repository.GetSections("ART", yrq, facets);
                Assert.IsTrue(sections.Count > 0, "No records found.");

                int count = sections.Where(s => s.Yrq.ID == yrq.ID && s.CourseID.StartsWith("ART")).Count();
                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_ByCourseIDCollection_WithYrq_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                int courseIdCount     = 3;
                IList <ICourseID> ids = _dataVerifier.GetCourseIDListFromQuery("eng", courseIdCount, string.Format(" and YearQuarterID = '{0}' ", yrq));

                IList <Section> sections     = repository.GetSections(ids, yrq, TestHelper.GetFacets());
                int             sectionCount = sections.Count;

                Assert.IsTrue(courseIdCount <= sectionCount, "Sections returned ({0}) is less than # of CourseIDs ({1})", sectionCount, courseIdCount);
            }
        }
        public void GetSections_VerifyContinuousEnrollementHasLastRegistrationDate()
        {
            IList <ISectionFacet> facets = TestHelper.GetFacets();

            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections             = repository.GetSections(facets);
                IList <Section> continuousEnrollment = sections.Where(s => s.IsContinuousEnrollment).ToList();

                int total = continuousEnrollment.Count;
                Assert.IsTrue(total > 0, "No continuous enrollment Sections found!");

                int missingDate = continuousEnrollment.Where(s => s.LastRegistrationDate == DateTime.MinValue).Count();
                Assert.IsTrue(missingDate == 0, "Found [{0} out of {1}] continuous enrollment Sections without a LastRegistrationDate", missingDate, total);
            }
        }
        public void GetSections_VerifySortedByYearQuarterID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(TestHelper.GetFacets());
                string          prevYrq  = "0000";

                // TODO: is there a more efficient way to determine that the whole list is sorted?
                foreach (ISection section in sections)
                {
                    string thisYrq = section.Yrq.ID;
                    Assert.IsTrue(thisYrq.CompareTo(prevYrq) >= 0, "Invalid order found: [{0}] is not less than [{1}]", prevYrq, thisYrq);

                    prevYrq = thisYrq;
                }
            }
        }
        public void GetSections_VerifySortedByCourseID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections     = repository.GetSections("ENGL", YearQuarter.FromString("B122"));
                string          prevCourseID = "    ";

                // TODO: is there a more efficient way to determine that the whole list is sorted?
                foreach (ISection section in sections)
                {
                    string thisCourseID = section.CourseID;
                    Assert.IsTrue(thisCourseID.CompareTo(prevCourseID) >= 0, "Invalid order found: [{0}] is not less than [{1}]", prevCourseID, thisCourseID);

                    prevCourseID = thisCourseID;
                }
            }
        }
        public void GetSectionsBy_CourseID_Yrq_VerifyOffered()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                IList <Section> sections = repository.GetSections(TestHelper.Data.CourseIDOfferedEveryQuarter, yrq, TestHelper.GetFacets());

                Assert.IsTrue(sections.Where(s => s.Offered != null).Count() > 0, "InstructionDetails are not being populated from the database");                      // check for all NULL from the database

                int sectionsWithOffered = sections.Where(s => s.Offered.Count() > 0).Count();
                Assert.IsTrue(sectionsWithOffered > 0, "One or more Sections is missing an Offered collection");

                int tooManyOffered = sections.Where(s => s.Offered.Count() > 20).Count();
                Assert.IsFalse(tooManyOffered > 0, "One or more Sections has more than 20 Offered items, which is more than is reasonable to expect");
            }
        }
        public void GetSectionsBySubjectList_OneSubject_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <ISectionFacet> facets = TestHelper.GetFacets();

                IList <string> subjects = new List <string>(1)
                {
                    "CHEM"
                };

                IList <Section> sections = repository.GetSections(subjects, facetOptions: facets);
                int             count    = sections.Where(s => s.CourseSubject == "CHEM").Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_EndDateDifferentFromQuarter()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No records were returned.");

                int count = sections.Where(s => s.IsDifferentEndDate).Count();
                Assert.IsTrue(count > 0, "No DifferentEndDate records were found.");

                int allSectionCount = _dataVerifier.AllSectionsCount;
                Assert.IsTrue(count < allSectionCount, "ALL Section records were returned.");

                string whereClause   = "NOT EndDate IS NULL AND EndDate <> (select top 1 yq.LastClassDay from vw_YearQuarter yq where yq.YearQuarterID = Vw_Class.YearQuarterID)";
                int    expectedCount = _dataVerifier.GetSectionCount(whereClause);
                Assert.AreEqual(expectedCount, count);
            }
        }
        public void GetSectionsBySubjectList_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <ISectionFacet> facets = TestHelper.GetFacets();

                IList <string> subjects = new List <string>(2)
                {
                    "ENGL", "ENGL&"
                };

                YearQuarter     yrq      = YearQuarter.FromString("B122");
                IList <Section> sections = repository.GetSections(subjects, yrq);
                int             count    = sections.Where(s => s.CourseSubject == "ENGL").Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        private void VerifyTimeFacet(string start, string end)
        {
            using (OdsRepository repository = new OdsRepository())
            {
                TimeSpan startTime = TimeSpan.Parse(start);
                TimeSpan endTime   = TimeSpan.Parse(end);

                IList <ISectionFacet> facets = TestHelper.GetFacets(new TimeFacet(startTime, endTime));

                IList <Section> sections = repository.GetSections(facetOptions: facets);
                Assert.IsTrue(sections.Count > 0, "No sections were returned");

                // make sure we have sections that fall in the specified range...
                int rightSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) >= 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) <= 0)).Count() > 0).Count();
                Assert.IsTrue(rightSectionCount > 0, "Section records do not include start/end times in the specified range.");

                // ... and that we don't have any that fall outside that range
                int wrongSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) < 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) > 0)).Count() > 0).Count();
                Assert.IsTrue(wrongSectionCount <= 0, "Found {0} sections with start/end times outside of {1} - {2}", wrongSectionCount, startTime, endTime);
            }
        }
        public void GetSections_VerifyInstructor()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections(CourseID.FromString("ENGL", "101"));

                ISection sec = sections.Where(s => s.Offered != null && s.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorID) &&
                                                                                        !string.IsNullOrWhiteSpace(o.InstructorName)
                                                                                        )
                                              .Count() > 0)
                               .Take(1).Single();

                OfferedItem item = sec.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorID) &&
                                                     !string.IsNullOrWhiteSpace(o.InstructorName)
                                                     )
                                   .Take(1).Single();

                string expected = _dataVerifier.GetInstructorName(item.InstructorID);

                Assert.AreEqual(expected, item.InstructorName);
            }
        }
        public void GetSections_ByCourseIDCollection_Success()
        {
            IList<ICourseID> ids = _dataVerifier.GetCourseIDListFromQuery("stud", 3);
            int expectedCount = ids.Count;

            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(ids, facetOptions: TestHelper.GetFacets());
                int sectionCount = sections.Count;

                Assert.IsTrue(expectedCount <= sectionCount, "Sections returned ({0}) is less than # of CourseIDs ({1})", sectionCount, expectedCount);
            }
        }
        public void GetSections_StartDateDifferentFromQuarter()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No records were returned.");

                int count = sections.Where(s => s.IsDifferentStartDate).Count();
                Assert.IsTrue(count > 0, "No DifferentStartDate records were found.");

                int allSectionCount = _dataVerifier.AllSectionsCount;
                Assert.IsTrue(count < allSectionCount, "ALL Section records were returned.");

                string whereClause = "NOT StartDate IS NULL AND StartDate <> (select top 1 yq.FirstClassDay from vw_YearQuarter yq where yq.YearQuarterID = Vw_Class.YearQuarterID)";
                int expectedCount = _dataVerifier.GetSectionCount(whereClause);
                Assert.AreEqual(expectedCount, count);
            }
        }
        public void GetSections_ByCourseIDCollection_WithYrq_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                int courseIdCount = 3;
                IList<ICourseID> ids = _dataVerifier.GetCourseIDListFromQuery("eng", courseIdCount, string.Format(" and YearQuarterID = '{0}' ", yrq));

                IList<Section> sections = repository.GetSections(ids, yrq, TestHelper.GetFacets());
                int sectionCount = sections.Count;

                Assert.IsTrue(courseIdCount <= sectionCount, "Sections returned ({0}) is less than # of CourseIDs ({1})", sectionCount, courseIdCount);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="excludedSection"></param>
        private void AssertExcludedSection(string excludedSection)
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No Sections were returned.");

                int count = sections.Where(s => s.ID.ToString() == excludedSection).Count();
                Assert.IsTrue(count <= 0, "Sections collection contains a record that should be filtered out: ({0})", excludedSection);
            }
        }
        public void GetSections_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(TestHelper.GetFacets());

                /* Additional Debugging
                string yrq = "B233";
                string[] ins = {"3468", "3472"};
                IEnumerable<Section> sec = sections.Where(s => ins.Contains(s.ID.ItemNumber) && s.ID.YearQuarter == yrq);
                // */

                Assert.IsTrue(sections.Count > 0);
            }
        }
        public void GetSections_ByClassIDCollection_Success()
        {
            int sectionCount = 3;
            IList<ISectionID> ids = _dataVerifier.GetSectionIDListFromQuery("english", sectionCount);

            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(ids, TestHelper.GetFacets());

                Assert.AreEqual(sectionCount, sections.Count);
            }
        }
        public void GetSectionsByYearQuarter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                string yearQuarterId = "B012";
                YearQuarter yrq = YearQuarter.FromString(yearQuarterId);

                IList<Section> sections = repository.GetSections(yrq);
                int count = sections.Where(s => s.Yrq.ID == yearQuarterId).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSectionsBySubjectList_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<ISectionFacet> facets = TestHelper.GetFacets();

                IList<string> subjects = new List<string>(2) {"ENGL", "ENGL&"};

                YearQuarter yrq = YearQuarter.FromString("B122");
                IList<Section> sections = repository.GetSections(subjects, yrq);
                int count = sections.Where(s => s.CourseSubject == "ENGL").Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_VerifyInstructor()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(CourseID.FromString("ENGL", "101"));

                ISection sec = sections.Where(s => s.Offered != null && s.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorID) &&
                                                                                                                                                                        !string.IsNullOrWhiteSpace(o.InstructorName)
                                                                                                                                                )
                                                                                                                                                .Count() > 0)
                                                            .Take(1).Single();

                OfferedItem item = sec.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorID) &&
                                                                                                    !string.IsNullOrWhiteSpace(o.InstructorName)
                                                                            )
                                                                            .Take(1).Single();

                string expected = _dataVerifier.GetInstructorName(item.InstructorID);

                Assert.AreEqual(expected, item.InstructorName);
            }
        }
        public void GetSections_VerifySortedByCourseID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections("ENGL", YearQuarter.FromString("B122"));
                string prevCourseID = "    ";

                // TODO: is there a more efficient way to determine that the whole list is sorted?
                foreach (ISection section in sections)
                {
                    string thisCourseID = section.CourseID;
                    Assert.IsTrue(thisCourseID.CompareTo(prevCourseID) >= 0, "Invalid order found: [{0}] is not less than [{1}]", prevCourseID, thisCourseID);

                    prevCourseID = thisCourseID;
                }
            }
        }
        public void GetSections_VerifyIsLinkedClasses()
        {
            IList<ISectionFacet> facets = TestHelper.GetFacets();

            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(facets);

                int expected = _dataVerifier.GetSectionCount("isnull(ItemYRQLink, '') <> '' and ItemYRQLink <> ItemNumber");
                int actual = sections.Where(s => s.IsLinked).Count();

                Assert.AreEqual(expected, actual);
            }
        }
        public void GetSections_VerifySortedByYearQuarterID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(TestHelper.GetFacets());
                string prevYrq = "0000";

                // TODO: is there a more efficient way to determine that the whole list is sorted?
                foreach (ISection section in sections)
                {
                    string thisYrq = section.Yrq.ID;
                    Assert.IsTrue(thisYrq.CompareTo(prevYrq) >= 0, "Invalid order found: [{0}] is not less than [{1}]", prevYrq, thisYrq);

                    prevYrq = thisYrq;
                }
            }
        }
        public void GetSections_VerifyWaitlist()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(TestHelper.GetFacets());

                int actualSectionCount = sections.Where(s => s.WaitlistCount > 0).Count();
                int expectedSectionCount = _dataVerifier.GetSectionCount("ClassID in (select w.ClassID from vw_Waitlist w where w.[Status] = 'W-LISTED')");

                Assert.AreEqual(expectedSectionCount, actualSectionCount);
            }
        }
        public void GetSectionsBySubject_WithQuarterFilter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = YearQuarter.FromString("B122");
                IList<Section> sections = repository.GetSections("ENGL", yrq);
                int count = sections.Where(s => s.Yrq.ID == "B122" && s.CourseID.StartsWith("ENGL")).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSectionsBySubjectList_OneSubject_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<ISectionFacet> facets = TestHelper.GetFacets();

                IList<string> subjects = new List<string>(1) {"CHEM"};

                IList<Section> sections = repository.GetSections(subjects, facetOptions: facets);
                int count = sections.Where(s => s.CourseSubject == "CHEM").Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_VerifyCourseDescriptions()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0);

                IEnumerable<Section> withNonNullDesc = sections.Where(s => s.CourseDescriptions != null && s.CourseDescriptions.Count > 0);
                Assert.IsTrue(withNonNullDesc.Count() > 0, "All CourseDescriptions properties are null");
            }
        }
        public void GetSectionsByCourseID_WithYrq_VerifyInstructorEmail()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = YearQuarter.FromString("B233");
                string courseId = "ART 101";

                IList<Section> sections = repository.GetSections(CourseID.FromString(courseId), yrq, TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No sections found for {0} in {1}", courseId, yrq.FriendlyName);

                int emailCount = sections.Where(s => s.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorEmail)).Count() > 0).Count();
                Assert.IsTrue(emailCount > 0, "No instructor e-mails found.");
            }
        }
        public void GetSections_VerifyContinuousEnrollementHasLastRegistrationDate()
        {
            IList<ISectionFacet> facets = TestHelper.GetFacets();

            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(facets);
                IList<Section> continuousEnrollment = sections.Where(s => s.IsContinuousEnrollment).ToList();

                int total = continuousEnrollment.Count;
                Assert.IsTrue(total > 0, "No continuous enrollment Sections found!");

                int missingDate = continuousEnrollment.Where(s => s.LastRegistrationDate == DateTime.MinValue).Count();
                Assert.IsTrue(missingDate == 0, "Found [{0} out of {1}] continuous enrollment Sections without a LastRegistrationDate", missingDate, total);
            }
        }
        public void GetSectionsBy_CourseID_Yrq_VerifyOffered()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                IList<Section> sections = repository.GetSections(TestHelper.Data.CourseIDOfferedEveryQuarter, yrq, TestHelper.GetFacets());

                Assert.IsTrue(sections.Where(s => s.Offered != null).Count() > 0, "InstructionDetails are not being populated from the database");	// check for all NULL from the database

                int sectionsWithOffered = sections.Where(s => s.Offered.Count() > 0).Count();
                Assert.IsTrue(sectionsWithOffered > 0, "One or more Sections is missing an Offered collection");

                int tooManyOffered = sections.Where(s => s.Offered.Count() > 20).Count();
                Assert.IsFalse(tooManyOffered > 0, "One or more Sections has more than 20 Offered items, which is more than is reasonable to expect");
            }
        }
        public void GetSections_VerifyCommonCourseCharacterRemovedFromCourseID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections("ENGL", YearQuarter.FromString("B122"));

                int count = sections.Where(s => s.CourseID.Contains("&")).Count();
                Assert.IsTrue(count == 0, "{0} records found to still contain the CCN character ('&') in the CourseID", count);
            }
        }
        public void GetSectionsByCourseID_WithYrq_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = YearQuarter.FromString("B012");
                IList<Section> sections = repository.GetSections(CourseID.FromString("ART 101"), yrq);

                Assert.IsTrue(sections.Count > 0);
            }
        }
        public void GetSectionsByCourseID_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<Section> sections = repository.GetSections(CourseID.FromString("ART 101"), facetOptions: TestHelper.GetFacets());

                Assert.IsTrue(sections.Count > 0);
            }
        }
Пример #50
0
        public void GetSections_Fall2011_OnCampus_WideTimeRange()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                TimeSpan startTime = new TimeSpan(2, 55, 0);
                TimeSpan endTime = new TimeSpan(22, 55, 0);

                IList<ISectionFacet> facets = new List<ISectionFacet>();
                facets.Add(new TimeFacet(startTime, endTime));
                facets.Add(new ModalityFacet(ModalityFacet.Options.OnCampus));
                facets.Add(new AvailabilityFacet(AvailabilityFacet.Options.All));

                string subject = null;

            //				IList<Section> sections = repository.GetSections(subject, YearQuarter.FromString("B122"), facets);
                IList<Section> sections = repository.GetSections(YearQuarter.FromString("B122"), facets);
                Assert.IsTrue(sections.Count > 0, "No sections were returned");

                // make sure we have sections that fall in the specified range...
                int rightSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) >= 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) <= 0)).Count() > 0).Count();
                Assert.IsTrue(rightSectionCount > 0, "Section records do not include start/end times in the specified range.");

                // ... and that we don't have any that fall outside that range
                int wrongSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) < 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) > 0)).Count() > 0).Count();
                Assert.IsTrue(wrongSectionCount <= 0, "Found {0} sections with start/end times outside of {1} - {2}", wrongSectionCount, startTime, endTime);
            }
        }
        public void GetSectionsBySubject_WithQuarterFilter_OnCampus_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = YearQuarter.FromString("B122");
                IList<ISectionFacet> facets = new List<ISectionFacet>(1);
                facets.Add(new ModalityFacet(ModalityFacet.Options.OnCampus));

                IList<Section> sections = repository.GetSections("ART", yrq, facets);
                Assert.IsTrue(sections.Count > 0, "No records found.");

                int count = sections.Where(s => s.Yrq.ID == yrq.ID && s.CourseID.StartsWith("ART")).Count();
                Assert.AreEqual(sections.Count, count);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        private void VerifyTimeFacet(string start, string end)
        {
            using (OdsRepository repository = new OdsRepository())
            {
                TimeSpan startTime = TimeSpan.Parse(start);
                TimeSpan endTime = TimeSpan.Parse(end);

                IList<ISectionFacet> facets = TestHelper.GetFacets(new TimeFacet(startTime, endTime));

                IList<Section> sections = repository.GetSections(facetOptions: facets);
                Assert.IsTrue(sections.Count > 0, "No sections were returned");

                // make sure we have sections that fall in the specified range...
                int rightSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) >= 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) <= 0)).Count() > 0).Count();
                Assert.IsTrue(rightSectionCount > 0, "Section records do not include start/end times in the specified range.");

                // ... and that we don't have any that fall outside that range
                int wrongSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) < 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) > 0)).Count() > 0).Count();
                Assert.IsTrue(wrongSectionCount <= 0, "Found {0} sections with start/end times outside of {1} - {2}", wrongSectionCount, startTime, endTime);
            }
        }
        //
        // GET: /Search/
        public ActionResult Index(string searchterm, string Subject, string quarter, string timestart, string timeend, string day_su, string day_m, string day_t, string day_w, string day_th, string day_f, string day_s, string f_oncampus, string f_online, string f_hybrid, string avail, string latestart, string numcredits, int p_offset = 0)
        {
            // We don't currently support quoted phrases. - 4/19/2012, [email protected]
            searchterm = searchterm.Replace("\"", string.Empty);

            // TODO: This needs to be configurable
            if (quarter == "CE")
            {
                Response.Redirect("http://www.campusce.net/BC/Search/Search.aspx?q=" + searchterm, true);
                return null;
            }

            if (String.IsNullOrEmpty(searchterm.Trim()))
            {
                return RedirectToAction("AllClasses", "Classes", new { YearQuarterID = quarter });
            }

            ViewBag.timestart = timestart;
            ViewBag.timeend = timeend;
              ViewBag.avail = avail;
              ViewBag.Modality = Helpers.ConstructModalityList(f_oncampus, f_online, f_hybrid);
            ViewBag.Days = Helpers.ConstructDaysList(day_su, day_m, day_t, day_w, day_th, day_f, day_s);
            ViewBag.Subject = Subject;
            ViewBag.searchterm = Regex.Replace(searchterm, @"\s+", " ");	// replace each clump of whitespace w/ a single space (so the database can better handle it)
              ViewBag.ErrorMsg = string.Empty;

            IList<ISectionFacet> facets = Helpers.addFacets(timestart, timeend, day_su, day_m, day_t, day_w, day_th, day_f, day_s,
                                                            f_oncampus, f_online, f_hybrid, avail, latestart, numcredits);

            ViewBag.LinkParams = Helpers.getLinkParams(Request, "submit");

            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = string.IsNullOrWhiteSpace(quarter) ? repository.CurrentYearQuarter : YearQuarter.FromFriendlyName(quarter);
            IList<YearQuarter> menuQuarters = Helpers.GetYearQuarterListForMenus(repository);
              QuarterNavigationModel quarterNavigation = new QuarterNavigationModel
                                                           {
                                                             NavigationQuarters = menuQuarters,
                                                             CurrentQuarter = menuQuarters[0],
                                                             ViewingQuarter = yrq,
                                                           };

                IList<Section> sections;
                using (_profiler.Step("API::GetSections()"))
                {
                    if (string.IsNullOrWhiteSpace(Subject))
                    {
                        sections = repository.GetSections(yrq, facets);
                    }
                    else
                    {
            IList<string> prefixes = SubjectInfo.GetSubjectPrefixes(Subject);
                        sections = repository.GetSections(prefixes, yrq, facets);
                    }
                }

            int currentPage;
            int totalPages;
            int itemCount;
            IList<SectionWithSeats> sectionsEnum;
                IList<SearchResult> searchResults;
            SearchResultNoSectionModel noSectionSearchResults;
              IList<SectionsBlock> courseBlocks;
              using (ClassScheduleDb db = new ClassScheduleDb())
                {
                    searchResults = GetSearchResults(db, searchterm, quarter);
                    noSectionSearchResults = GetNoSectionSearchResults(db, searchterm, yrq);

              sections = (from s in sections
                      join r in searchResults on s.ID.ToString() equals r.ClassID
                      select s).ToList();

                    sectionsEnum = Helpers.GetSectionsWithSeats(yrq.ID, sections, db);

              // do not count Linked sections (since we don't display them)
              itemCount = sectionsEnum.Count(s => !s.IsLinked);

                  totalPages = (int)Math.Round((itemCount / ITEMS_PER_PAGE) + 0.5);
                  currentPage = p_offset + 1;

              using (_profiler.Step("Getting just records for page"))
              {
            if (currentPage > totalPages && totalPages > 0)
            {
              currentPage = totalPages;
            }
            sectionsEnum = sectionsEnum.Skip(p_offset * ITEMS_PER_PAGE).Take(ITEMS_PER_PAGE).ToList();
              }

              courseBlocks = Helpers.GroupSectionsIntoBlocks(sectionsEnum, db);
                }

                IEnumerable<string> allSubjects;
                using (_profiler.Step("Getting distinct list of subjects"))
                {
                    allSubjects = sectionsEnum.Select(c => c.CourseSubject).Distinct().OrderBy(c => c);
                }

            SearchResultsModel model = new SearchResultsModel
                                           {
                                             ItemCount = itemCount,
                                       TotalPages = totalPages,
                                       CurrentPage = currentPage,
                                       Courses = courseBlocks,
                                             SearchResultNoSection = noSectionSearchResults,
                                             AllSubjects = allSubjects,
                                       QuarterNavigation = quarterNavigation,
                                           };
                return View(model);
            }
        }
Пример #54
0
        public JsonResult CrossListedCourses(string courseID, string yearQuarterID)
        {
            // TODO: Validate incoming yearQuarterID value
              // see https://github.com/BellevueCollege/CtcApi/issues/8

            if (yearQuarterID.Length != 4)
            {
              _log.Error(m => m("An invalid YearQuarterID was provided for looking up cross-listed sections: '{0}'", yearQuarterID));
            }
            else
            {
              using (ClassScheduleDb db = new ClassScheduleDb())
              {
            string[] classIDs = (from c in db.SectionCourseCrosslistings
                                 where c.CourseID == courseID
                                       && c.ClassID.EndsWith(yearQuarterID)
                                 select c.ClassID).ToArray();

            if (!classIDs.Any())
            {
            _log.Warn(m => m("No cross-listed Sections were found for Course '{0}' in '{1}'", courseID, yearQuarterID));
              }
            else
            {
              int count = classIDs.Count();
              _log.Trace(m => m("{0} cross-listed sections found for '{1}': [{2}]", count, courseID, classIDs.Mash()));

            // HACK: SectionID constructors are currently protected, so we have to manually create them
              IList<ISectionID> sectionIDs = new List<ISectionID>(count);
              foreach (string id in classIDs)
              {
                sectionIDs.Add(SectionID.FromString(id));
              }

              // write a warning to the log if we've got too many courses cross-listed with this section
              if (_log.IsWarnEnabled && sectionIDs.Count > MAX_COURSE_CROSSLIST_WARNING_THRESHOLD)
              {
                _log.Warn(m => m("Cross-listing logic assumes a very small number of Sections will be cross-listed with any given Course, but is now being asked to process {0} Sections for '{1}'. (This warning triggers when more than {2} are detected.)",
                                  sectionIDs.Count, courseID, MAX_COURSE_CROSSLIST_WARNING_THRESHOLD));
              }

              using (OdsRepository ods = new OdsRepository())
              {
                IList<Section> odsSections = ods.GetSections(sectionIDs);

                IList<SectionWithSeats> classScheduleSections = Helpers.GetSectionsWithSeats(yearQuarterID,
                                                                                             odsSections.ToList(), db);

                IList<CrossListedCourseModel> crosslistings = (from c in classScheduleSections
                                                               select new CrossListedCourseModel
                                                                        {
                                                                          // BUG: API doesn't property notify CourseID in derived class
                                                                          CourseID = CourseID.FromString(c.CourseID),
                                                                          SectionID = c.ID,
                                                                          // HACK: Remove IsCommonCourse property when API is fixed (see above)
                                                                          IsCommonCourse = c.IsCommonCourse,
                                                                          Credits = c.Credits,
                                                                          IsVariableCredits = c.IsVariableCredits,
                                                                          Title = c.CourseTitle
                                                                        }).ToList();

                // NOTE: AllowGet exposes the potential for JSON Hijacking (see http://haacked.com/archive/2009/06/25/json-hijacking.aspx)
                // but is not an issue here because we are receiving and returning public (e.g. non-sensitive) data
                return Json(crosslistings, JsonRequestBehavior.AllowGet);
              }
            }
              }
            }
            return Json(null, JsonRequestBehavior.AllowGet);
        }
        public void GetSections_SimulateClassScheduleApplication()
        {
            // Simulates actual call from Online Class Schedule application - which passes extra
            IList<ISectionFacet> facets = TestHelper.GetFacets(new ModalityFacet(ModalityFacet.Options.Online));
            facets.Add(new TimeFacet(new TimeSpan(0, 0, 0), new TimeSpan(23, 59, 0)));
            facets.Add(new DaysFacet(DaysFacet.Options.All));

            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                string subject = TestHelper.Data.CourseSubjectOfferedEveryQuarter;
                IList<Section> sections = repository.GetSections(subject, yrq, facets);

                int count = sections.Count;
                Assert.IsTrue(count > 0, "No records returned.");

                int expectedSectionCount = _dataVerifier.GetSectionCount(string.Format("(CourseID like '{0}%' and SBCTCMisc1 like '3%' and YearQuarterID = '{1}')", subject, yrq.ID));
                Assert.AreEqual(expectedSectionCount, count);

                int allSectionCount = _dataVerifier.GetSectionCount("not ClassID is null");
                Assert.IsTrue(allSectionCount > count, "Query failed: ALL records were returned.");
            }
        }
Пример #56
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="facet"></param>
        /// <param name="includeQuarterFilter"></param>
        /// <returns></returns>
        public static IList<Section> GetSectionsWithFilter(ISectionFacet facet, bool includeQuarterFilter = true)
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList<ISectionFacet> facets = GetFacets(facet, includeQuarterFilter);

                return repository.GetSections(facets);
            }
        }
        public ActionResult YearQuarterSubject(String YearQuarter, string Subject, string timestart, string timeend, string day_su, string day_m, string day_t, string day_w, string day_th, string day_f, string day_s, string f_oncampus, string f_online, string f_hybrid, string avail, string latestart, string numcredits, string format)
        {
            IList<ISectionFacet> facets = Helpers.addFacets(timestart, timeend, day_su, day_m, day_t, day_w, day_th, day_f, day_s, f_oncampus, f_online, f_hybrid, avail, latestart, numcredits);

            using (OdsRepository repository = new OdsRepository())
            {
            YearQuarter yrq = Helpers.DetermineRegistrationQuarter(YearQuarter, repository.CurrentRegistrationQuarter, RouteData);

            // Get the courses to display on the View
                IList<Section> sections;
                using (_profiler.Step("ODSAPI::GetSections()"))
                {
                    IList<string> prefixes = SubjectInfo.GetSubjectPrefixes(Subject);
                    sections = repository.GetSections(prefixes, yrq, facets);
                }

            #if DEBUG
              /* COMMENT THIS LINE FOR DEBUGGING/TROUBLESHOOTING
            Debug.Print("==> sections");
            string zItemNum = "1230", zYrq = "B234";  // ENGL 266
            if (sections.Any(s => s.ID.ItemNumber == zItemNum && s.ID.YearQuarter == zYrq))
            {
              Section foo = sections.Where(s => s.ID.ItemNumber == zItemNum && s.ID.YearQuarter == zYrq).First();
              Debug.Print("\n{0} - {1} {2}\t(Linked to: {3})", foo.ID, foo.CourseID, foo.CourseTitle, foo.LinkedTo);
            }
            else
            {
              Debug.Print("ClassID '{0}{1}' not found.", zItemNum, zYrq);
            }
            // */
            #endif

            IList<SectionsBlock> courseBlocks;
              using (ClassScheduleDb db = new ClassScheduleDb())
                {
                    IList<SectionWithSeats> sectionsEnum;
                    using (_profiler.Step("Getting app-specific Section records from DB"))
                    {
                        sectionsEnum = Helpers.GetSectionsWithSeats(yrq.ID, sections, db);
                    }

            #if DEBUG
              /* COMMENT THIS LINE FOR DEBUGGING/TROUBLESHOOTING
                  Debug.Print("==> sectionsEnum");
            //				  string zItemNum, zYrq;
                  zItemNum = "1230"; zYrq = "B234"; // ENGL 266
              if (sectionsEnum.Any(s => s.ID.ItemNumber == zItemNum && s.ID.YearQuarter == zYrq))
                  {
                    SectionWithSeats foo = sectionsEnum.Where(s => s.ID.ItemNumber == zItemNum && s.ID.YearQuarter == zYrq).First();
                    Debug.Print("\n{0} - {1} {2}\t(Linked to: {3})", foo.ID, foo.CourseID, foo.CourseTitle, foo.LinkedTo);
                  }
              else
              {
            Debug.Print("ClassID '{0}{1}' not found.", zItemNum, zYrq);
              }
              // */

              /* COMMENT THIS LINE FOR DEBUGGING/TROUBLESHOOTING
                  IEnumerable<SectionWithSeats> s1 = sectionsEnum.Where(s => s.CourseSubject == "ENGL" && s.CourseNumber == "239");
              // */
            #endif
                    courseBlocks = Helpers.GroupSectionsIntoBlocks(sectionsEnum, db);
            }

            // Construct the model
            SubjectInfoResult subject = SubjectInfo.GetSubjectInfoFromPrefix(Subject);
            IList<YearQuarter> yrqRange = Helpers.GetYearQuarterListForMenus(repository);

              YearQuarterSubjectModel model = new YearQuarterSubjectModel
                                                {
                                                  Courses = courseBlocks,
                                                  CurrentQuarter = repository.CurrentYearQuarter,
                                                  CurrentRegistrationQuarter = yrqRange[0],
                                                  NavigationQuarters = yrqRange,
                                                  ViewingQuarter = yrq,
                                            // if we were unable to determine a Slug, use the Subject (e.g. Prefix) that brought us here
                                                  Slug = subject != null ? subject.Subject.Slug : Subject,
                                                  SubjectTitle = subject != null ? subject.Subject.Title : string.Empty,
                                                  SubjectIntro = subject != null ? subject.Subject.Intro : string.Empty,
                                                  DepartmentTitle = subject != null ? subject.Department.Title : string.Empty,
                                                  DepartmentURL = subject != null ? subject.Department.URL : string.Empty,
                                                };

                if (format == "json")
                {
                  // NOTE: AllowGet exposes the potential for JSON Hijacking (see http://haacked.com/archive/2009/06/25/json-hijacking.aspx)
                  // but is not an issue here because we are receiving and returning public (e.g. non-sensitive) data
                  return Json(model, JsonRequestBehavior.AllowGet);
                }

            // set up all the ancillary data we'll need to display the View
                ViewBag.timestart = timestart;
                ViewBag.timeend = timeend;
                ViewBag.avail = avail;
                ViewBag.latestart = latestart;
            ViewBag.Modality = Helpers.ConstructModalityList(f_oncampus, f_online, f_hybrid);
            ViewBag.Days = Helpers.ConstructDaysList(day_su, day_m, day_t, day_w, day_th, day_f, day_s);
            ViewBag.LinkParams = Helpers.getLinkParams(Request);
            SetCommonViewBagVars(repository, avail, string.Empty);

            // TODO: Add query string info (e.g. facets) to the routeValues dictionary so we can pass it all as one chunk.
                IDictionary<string, object> routeValues = new Dictionary<string, object>(3);
                routeValues.Add("YearQuarterID", YearQuarter);
                ViewBag.RouteValues = routeValues;

                return View(model);
            }
        }