public async Task <ActionResult> Index(string matNo, string name, UnitType unit = UnitType.AbsoluteMoney, RevenueGroupType tab = RevenueGroupType.Expenditure, MatFinancingType financing = MatFinancingType.TrustAndAcademies, ChartFormat format = ChartFormat.Charts)
        {
            ChartGroupType chartGroup;

            switch (tab)
            {
            case RevenueGroupType.Expenditure:
                chartGroup = ChartGroupType.TotalExpenditure;
                break;

            case RevenueGroupType.Income:
                chartGroup = ChartGroupType.TotalIncome;
                break;

            case RevenueGroupType.Balance:
                chartGroup = ChartGroupType.InYearBalance;
                break;

            default:
                chartGroup = ChartGroupType.All;
                break;
            }

            var latestYear = _financialDataService.GetLatestDataYearForTrusts();
            var term       = FormatHelpers.FinancialTermFormatAcademies(latestYear);

            var dataResponse = _financialDataService.GetAcademiesByMatNumber(term, matNo);

            var sponsorVM = await BuildSponsorVMAsync(matNo, name, dataResponse, tab, chartGroup, financing);

            List <string> terms      = _financialDataService.GetActiveTermsForMatCentral();
            var           latestTerm = terms.First();

            UnitType unitType;

            switch (tab)
            {
            case RevenueGroupType.Workforce:
                unitType = UnitType.AbsoluteCount;
                break;

            case RevenueGroupType.Balance:
                unitType = unit == UnitType.AbsoluteMoney || unit == UnitType.PerPupil || unit == UnitType.PerTeacher ? unit : UnitType.AbsoluteMoney;
                break;

            default:
                unitType = unit;
                break;
            }

            _fcService.PopulateHistoricalChartsWithSchoolData(sponsorVM.HistoricalCharts, sponsorVM.HistoricalSchoolFinancialDataModels, latestTerm, tab, unitType, SchoolFinancialType.Academies);

            ViewBag.Tab         = tab;
            ViewBag.ChartGroup  = chartGroup;
            ViewBag.UnitType    = unitType;
            ViewBag.Financing   = financing;
            ViewBag.ChartFormat = format;

            return(View(sponsorVM));
        }
        private async Task <List <SchoolFinancialDataModel> > GetFinancialDataHistoricallyAsync(string matCode, MatFinancingType matFinancing)
        {
            var models     = new List <SchoolFinancialDataModel>();
            var latestYear = _financialDataService.GetLatestDataYearForTrusts();

            var taskList = new List <Task <IEnumerable <Document> > >();

            for (int i = ChartHistory.YEARS_OF_HISTORY - 1; i >= 0; i--)
            {
                var term = FormatHelpers.FinancialTermFormatAcademies(latestYear - i);
                var task = _financialDataService.GetMATDataDocumentAsync(matCode, term, matFinancing);
                taskList.Add(task);
            }

            for (int i = ChartHistory.YEARS_OF_HISTORY - 1; i >= 0; i--)
            {
                var term           = FormatHelpers.FinancialTermFormatAcademies(latestYear - i);
                var taskResult     = await taskList[ChartHistory.YEARS_OF_HISTORY - 1 - i];
                var resultDocument = taskResult?.FirstOrDefault();

                if (resultDocument != null && resultDocument.GetPropertyValue <bool>("DNS"))
                {
                    var emptyDoc = new Document();
                    emptyDoc.SetPropertyValue("DNS", true);
                    resultDocument = emptyDoc;
                }

                models.Add(new SchoolFinancialDataModel(matCode, term, resultDocument, SchoolFinancialType.Academies));
            }

            return(models);
        }
Example #3
0
        private SchoolViewModel InstantiateBenchmarkSchool(string urn)
        {
            var benchmarkSchool = new SchoolViewModel(_contextDataService.GetSchoolByUrn(urn), base.ExtractSchoolComparisonListFromCookie());
            var latestYear      = _financialDataService.GetLatestDataYearPerSchoolType(benchmarkSchool.FinancialType);
            var term            = FormatHelpers.FinancialTermFormatAcademies(latestYear);
            var document        = _financialDataService.GetSchoolDataDocument(urn, term, benchmarkSchool.FinancialType);

            benchmarkSchool.HistoricalSchoolFinancialDataModels = new List <SchoolFinancialDataModel> {
                new SchoolFinancialDataModel(urn, term, document, benchmarkSchool.FinancialType)
            };
            return(benchmarkSchool);
        }
        private List <string> BuildTermsList(SchoolFinancialType type)
        {
            var years      = new List <string>();
            var latestYear = _financialDataService.GetLatestDataYearPerSchoolType(type);

            for (int i = 0; i < ChartHistory.YEARS_OF_HISTORY; i++)
            {
                years.Add(FormatHelpers.FinancialTermFormatAcademies(latestYear - i));
            }

            return(years);
        }
Example #5
0
        private async Task <List <SchoolFinancialDataModel> > GetFinancialDataForSchoolsAsync(List <BenchmarkSchoolViewModel> schools, CentralFinancingType centralFinancing = CentralFinancingType.Include)
        {
            var models = new List <SchoolFinancialDataModel>();

            var taskList = new List <Task <IEnumerable <Document> > >();

            foreach (var school in schools)
            {
                var schoolFinancialType = (SchoolFinancialType)Enum.Parse(typeof(SchoolFinancialType), school.FinancialType);
                var latestYear          = _financialDataService.GetLatestDataYearPerSchoolType(schoolFinancialType);
                var term = FormatHelpers.FinancialTermFormatAcademies(latestYear);

                var task = _financialDataService.GetSchoolDataDocumentAsync(school.Urn, term, schoolFinancialType, centralFinancing);
                taskList.Add(task);
            }

            for (var i = 0; i < schools.Count; i++)
            {
                var schoolFinancialType = (SchoolFinancialType)Enum.Parse(typeof(SchoolFinancialType), schools[i].FinancialType);
                var latestYear          = _financialDataService.GetLatestDataYearPerSchoolType(schoolFinancialType);
                var term           = FormatHelpers.FinancialTermFormatAcademies(latestYear);
                var taskResult     = await taskList[i];
                var resultDocument = taskResult?.FirstOrDefault();
                var dataGroup      = schools[i].FinancialType;

                if (schoolFinancialType == SchoolFinancialType.Academies)
                {
                    dataGroup = (centralFinancing == CentralFinancingType.Include) ? DataGroups.MATDistributed : DataGroups.Academies;
                }

                if (dataGroup == DataGroups.MATDistributed && resultDocument == null)//if nothing found in -Distributed collection try to source it from (non-distributed) Academies data
                {
                    resultDocument = (await _financialDataService.GetSchoolDataDocumentAsync(schools[i].Urn, term, schoolFinancialType, CentralFinancingType.Exclude))
                                     ?.FirstOrDefault();
                }

                if (resultDocument != null && resultDocument.GetPropertyValue <bool>("DNS"))//School did not submit finance, return & display "no data" in the charts
                {
                    resultDocument = null;
                }

                models.Add(new SchoolFinancialDataModel(schools[i].Urn, term, resultDocument, (SchoolFinancialType)Enum.Parse(typeof(SchoolFinancialType), schools[i].FinancialType)));
            }

            return(models);
        }
        public async Task <ActionResult> Download(string matNo, string name)
        {
            var latestYear = _financialDataService.GetLatestDataYearForTrusts();
            var term       = FormatHelpers.FinancialTermFormatAcademies(latestYear);

            var response = _financialDataService.GetAcademiesByMatNumber(term, matNo);

            var sponsorVM = await BuildSponsorVMAsync(matNo, name, response, RevenueGroupType.AllExcludingSchoolPerf, ChartGroupType.All, MatFinancingType.TrustOnly);

            var termsList = _financialDataService.GetActiveTermsForMatCentral();

            _fcService.PopulateHistoricalChartsWithSchoolData(sponsorVM.HistoricalCharts, sponsorVM.HistoricalSchoolFinancialDataModels, termsList.First(), RevenueGroupType.AllExcludingSchoolPerf, UnitType.AbsoluteMoney, SchoolFinancialType.Academies);

            string csv = _csvBuilder.BuildCSVContentHistorically(sponsorVM, latestYear);

            return(File(Encoding.UTF8.GetBytes(csv),
                        "text/plain",
                        $"HistoricalData-{name}.csv"));
        }
        private async Task <List <SchoolFinancialDataModel> > GetFinancialDataHistoricallyAsync(string urn, SchoolFinancialType schoolFinancialType, CentralFinancingType cFinance)
        {
            var models     = new List <SchoolFinancialDataModel>();
            var latestYear = _financialDataService.GetLatestDataYearPerSchoolType(schoolFinancialType);

            var taskList = new List <Task <IEnumerable <Document> > >();

            for (int i = ChartHistory.YEARS_OF_HISTORY - 1; i >= 0; i--)
            {
                var term = FormatHelpers.FinancialTermFormatAcademies(latestYear - i);
                var task = _financialDataService.GetSchoolDataDocumentAsync(urn, term, schoolFinancialType, cFinance);
                taskList.Add(task);
            }

            for (int i = ChartHistory.YEARS_OF_HISTORY - 1; i >= 0; i--)
            {
                var term           = FormatHelpers.FinancialTermFormatAcademies(latestYear - i);
                var taskResult     = await taskList[ChartHistory.YEARS_OF_HISTORY - 1 - i];
                var resultDocument = taskResult?.FirstOrDefault();
                var dataGroup      = schoolFinancialType.ToString();

                if (schoolFinancialType == SchoolFinancialType.Academies)
                {
                    dataGroup = (cFinance == CentralFinancingType.Include) ? DataGroups.MATDistributed : DataGroups.Academies;
                }

                if (dataGroup == DataGroups.MATDistributed && resultDocument == null)//if nothing found in -Distributed collection try to source it from (non-distributed) Academies data
                {
                    resultDocument = (await _financialDataService.GetSchoolDataDocumentAsync(urn, term, schoolFinancialType, CentralFinancingType.Exclude))
                                     ?.FirstOrDefault();
                }

                if (resultDocument != null && resultDocument.GetPropertyValue <bool>("DNS"))//School did not submit finance, return & display "no data" in the charts
                {
                    resultDocument = null;
                }

                models.Add(new SchoolFinancialDataModel(urn, term, resultDocument, schoolFinancialType));
            }

            return(models);
        }
        /// <summary>
        /// Step 4 - Advanced
        /// </summary>
        /// <param name="urn"></param>
        /// <param name="comparisonType"></param>
        /// <param name="estType"></param>
        /// <param name="criteria"></param>
        /// <param name="areaType"></param>
        /// <param name="lacode"></param>
        /// <param name="schoolName"></param>
        /// <returns></returns>
        public ActionResult OverwriteStrategy(string urn, ComparisonType comparisonType, EstablishmentType estType, BenchmarkCriteriaVM criteria, ComparisonArea areaType, int?lacode, string schoolName)
        {
            ViewBag.URN            = urn;
            ViewBag.HomeSchoolName = schoolName;
            ViewBag.ComparisonType = comparisonType;
            ViewBag.EstType        = estType;
            ViewBag.AreaType       = areaType;
            ViewBag.LaCode         = lacode;

            var benchmarkList = base.ExtractSchoolComparisonListFromCookie();

            if (!ModelState.IsValid)
            {
                var benchmarkSchool = new SchoolViewModel(_contextDataService.GetSchoolByUrn(urn), benchmarkList);
                var latestYear      = _financialDataService.GetLatestDataYearPerSchoolType(benchmarkSchool.FinancialType);
                var term            = FormatHelpers.FinancialTermFormatAcademies(latestYear);
                var document        = _financialDataService.GetSchoolDataDocument(urn, term, benchmarkSchool.FinancialType);
                benchmarkSchool.HistoricalSchoolFinancialDataModels = new List <SchoolFinancialDataModel> {
                    new SchoolFinancialDataModel(urn, term, document, benchmarkSchool.FinancialType)
                };
                var schoolCharsVM = new SchoolCharacteristicsViewModel(benchmarkSchool, benchmarkList, new BenchmarkCriteria());
                schoolCharsVM.ErrorMessage = "Validation Error";
                return(View("AdvancedCharacteristics", schoolCharsVM));
            }

            if ((benchmarkList.BenchmarkSchools.Count > 1) ||
                (benchmarkList.BenchmarkSchools.Count == 1 && benchmarkList.BenchmarkSchools[0].Urn != benchmarkList.HomeSchoolUrn))
            {
                criteria.ComparisonList = benchmarkList;
                return(View(criteria));
            }
            else
            {
                TempData["URN"] = urn;
                TempData["BenchmarkCriteria"] = criteria.AdvancedCriteria;
                TempData["EstType"]           = estType;
                TempData["AreaType"]          = areaType;
                TempData["LaCode"]            = lacode;

                return(RedirectToAction("GenerateNewFromAdvancedCriteria", "BenchmarkCharts"));
            }
        }
Example #9
0
        public ActionResult Mats(RevenueGroupType tab = RevenueGroupType.Expenditure, MatFinancingType financing = MatFinancingType.TrustAndAcademies)
        {
            ChartGroupType chartGroup;

            switch (tab)
            {
            case RevenueGroupType.Expenditure:
                chartGroup = ChartGroupType.TotalExpenditure;
                break;

            case RevenueGroupType.Income:
                chartGroup = ChartGroupType.TotalIncome;
                break;

            case RevenueGroupType.Balance:
                chartGroup = ChartGroupType.InYearBalance;
                break;

            default:
                chartGroup = ChartGroupType.All;
                break;
            }

            var defaultUnitType = tab == RevenueGroupType.Workforce ? UnitType.AbsoluteCount : UnitType.AbsoluteMoney;
            var benchmarkCharts = BuildTrustBenchmarkCharts(tab, chartGroup, UnitType.AbsoluteMoney, financing);
            var chartGroups     = _benchmarkChartBuilder.Build(tab, EstablishmentType.MAT).DistinctBy(c => c.ChartGroup).ToList();

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(benchmarkCharts, null, chartGroups, ComparisonType.Manual, null, null, null, EstablishmentType.MAT, EstablishmentType.MAT, null, null, academiesTerm, maintainedTerm, ComparisonArea.All, null, null, ComparisonListLimit.DEFAULT, base.ExtractTrustComparisonListFromCookie());

            ViewBag.Tab               = tab;
            ViewBag.ChartGroup        = chartGroup;
            ViewBag.UnitType          = defaultUnitType;
            ViewBag.HomeSchoolId      = vm.TrustComparisonList.DefaultTrustMatNo;
            ViewBag.EstablishmentType = vm.EstablishmentType;
            ViewBag.TrustFinancing    = financing;

            return(View("Index", vm));
        }
Example #10
0
        public async Task <PartialViewResult> CustomReport(string json, ChartFormat format)
        {
            var customSelection = (CustomSelectionListViewModel)JsonConvert.DeserializeObject(json, typeof(CustomSelectionListViewModel));
            var customCharts    = ConvertSelectionListToChartList(customSelection.HierarchicalCharts);
            var comparisonList  = base.ExtractSchoolComparisonListFromCookie();

            var financialDataModels = await this.GetFinancialDataForSchoolsAsync(comparisonList.BenchmarkSchools, (CentralFinancingType)Enum.Parse(typeof(CentralFinancingType), customSelection.CentralFinance));

            var trimSchoolNames = Request.Browser.IsMobileDevice;

            _fcService.PopulateBenchmarkChartsWithFinancialData(customCharts, financialDataModels, comparisonList.BenchmarkSchools, comparisonList.HomeSchoolUrn, null, trimSchoolNames);

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(customCharts, base.ExtractSchoolComparisonListFromCookie(), null,
                                                     ComparisonType.Manual, null, null, null, EstablishmentType.All, EstablishmentType.All, null, null, academiesTerm, maintainedTerm, ComparisonArea.All, null, null, ComparisonListLimit.DEFAULT);

            ViewBag.ChartFormat = format;

            return(PartialView("Partials/CustomCharts", vm));
        }
        /// <summary>
        /// Step 3 - Advanced
        /// </summary>
        /// <param name="urn"></param>
        /// <param name="estType"></param>
        /// <param name="comparisonType"></param>
        /// <param name="areaType"></param>
        /// <param name="lacode"></param>
        /// <returns></returns>
        public ActionResult AdvancedCharacteristics(string urn, ComparisonType comparisonType, EstablishmentType estType, ComparisonArea?areaType, int?lacode,
                                                    string laNameText, BenchmarkCriteria AdvancedCriteria)
        {
            if (areaType == ComparisonArea.LaName && !string.IsNullOrEmpty(laNameText) && lacode == null)
            {
                var exactLaMatch = _laSearchService.SearchExactMatch(laNameText);
                if (exactLaMatch != null)
                {
                    lacode = Int32.Parse(exactLaMatch.id);
                }
            }

            ViewBag.URN            = urn;
            ViewBag.ComparisonType = comparisonType;
            ViewBag.EstType        = estType;
            ViewBag.AreaType       = areaType;
            ViewBag.LaCode         = lacode;

            var benchmarkSchool = new SchoolViewModel(_contextDataService.GetSchoolByUrn(urn), base.ExtractSchoolComparisonListFromCookie());
            var latestYear      = _financialDataService.GetLatestDataYearPerSchoolType(benchmarkSchool.FinancialType);
            var term            = FormatHelpers.FinancialTermFormatAcademies(latestYear);
            var document        = _financialDataService.GetSchoolDataDocument(urn, term, benchmarkSchool.FinancialType);

            benchmarkSchool.HistoricalSchoolFinancialDataModels = new List <SchoolFinancialDataModel> {
                new SchoolFinancialDataModel(urn, term, document, benchmarkSchool.FinancialType)
            };

            if (!IsAreaFieldsValid(areaType, lacode, benchmarkSchool))
            {
                ViewBag.Authorities = _laService.GetLocalAuthorities();
                return(View("ChooseRegion", benchmarkSchool));
            }

            var schoolCharsVM = new SchoolCharacteristicsViewModel(benchmarkSchool, base.ExtractSchoolComparisonListFromCookie(), AdvancedCriteria);

            return(View(schoolCharsVM));
        }
Example #12
0
        public async Task <PartialViewResult> TabChange(EstablishmentType type, UnitType showValue, RevenueGroupType tab = RevenueGroupType.Expenditure, CentralFinancingType financing = CentralFinancingType.Include, MatFinancingType trustFinancing = MatFinancingType.TrustAndAcademies, ChartFormat format = ChartFormat.Charts)
        {
            ChartGroupType chartGroup;

            switch (tab)
            {
            case RevenueGroupType.Expenditure:
                chartGroup = ChartGroupType.TotalExpenditure;
                break;

            case RevenueGroupType.Income:
                chartGroup = ChartGroupType.TotalIncome;
                break;

            case RevenueGroupType.Balance:
                chartGroup = ChartGroupType.InYearBalance;
                break;

            case RevenueGroupType.Workforce:
                chartGroup = ChartGroupType.Workforce;
                break;

            default:
                chartGroup = ChartGroupType.All;
                break;
            }

            UnitType unitType;

            switch (tab)
            {
            case RevenueGroupType.Workforce:
                unitType = UnitType.AbsoluteCount;
                break;

            case RevenueGroupType.Balance:
                unitType = showValue == UnitType.AbsoluteMoney || showValue == UnitType.PerPupil || showValue == UnitType.PerTeacher ? showValue : UnitType.AbsoluteMoney;
                break;

            default:
                unitType = showValue;
                break;
            }

            List <ChartViewModel> benchmarkCharts;

            if (type == EstablishmentType.MAT)
            {
                benchmarkCharts = BuildTrustBenchmarkCharts(tab, chartGroup, unitType, trustFinancing);
            }
            else
            {
                benchmarkCharts = await BuildSchoolBenchmarkChartsAsync(tab, chartGroup, unitType, financing);
            }
            var chartGroups = _benchmarkChartBuilder.Build(tab, EstablishmentType.All).DistinctBy(c => c.ChartGroup).ToList();

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(benchmarkCharts, base.ExtractSchoolComparisonListFromCookie(), chartGroups, ComparisonType.Manual, null, null, null, type, type, null, null, academiesTerm, maintainedTerm, ComparisonArea.All, null, null, ComparisonListLimit.DEFAULT, base.ExtractTrustComparisonListFromCookie());

            ViewBag.Tab               = tab;
            ViewBag.ChartGroup        = chartGroup;
            ViewBag.UnitType          = unitType;
            ViewBag.EstablishmentType = type;
            ViewBag.Financing         = financing;
            ViewBag.TrustFinancing    = trustFinancing;
            ViewBag.HomeSchoolId      = (type == EstablishmentType.MAT) ? vm.TrustComparisonList.DefaultTrustMatNo : vm.SchoolComparisonList.HomeSchoolUrn;
            ViewBag.ChartFormat       = format;

            return(PartialView("Partials/TabContent", vm));
        }
Example #13
0
        public async Task <ActionResult> Index(
            string urn,
            SimpleCriteria simpleCriteria,
            BenchmarkCriteria benchmarkCriteria,
            int basketSize = ComparisonListLimit.DEFAULT,
            SchoolFinancialDataModel benchmarkSchoolData = null,
            EstablishmentType searchedEstabType          = EstablishmentType.All,
            ComparisonType comparisonType = ComparisonType.Manual,
            ComparisonArea areaType       = ComparisonArea.All,
            string laCode                  = null,
            RevenueGroupType tab           = RevenueGroupType.Expenditure,
            CentralFinancingType financing = CentralFinancingType.Include)
        {
            ChartGroupType chartGroup;

            switch (tab)
            {
            case RevenueGroupType.Expenditure:
                chartGroup = ChartGroupType.TotalExpenditure;
                break;

            case RevenueGroupType.Income:
                chartGroup = ChartGroupType.TotalIncome;
                break;

            case RevenueGroupType.Balance:
                chartGroup = ChartGroupType.InYearBalance;
                break;

            case RevenueGroupType.Workforce:
                chartGroup = ChartGroupType.Workforce;
                break;

            default:
                chartGroup = ChartGroupType.All;
                break;
            }

            var defaultUnitType = tab == RevenueGroupType.Workforce ? UnitType.AbsoluteCount : UnitType.AbsoluteMoney;
            var benchmarkCharts = await BuildSchoolBenchmarkChartsAsync(tab, chartGroup, defaultUnitType, financing);

            var establishmentType = DetectEstablishmentType(base.ExtractSchoolComparisonListFromCookie());

            var chartGroups = _benchmarkChartBuilder.Build(tab, establishmentType).DistinctBy(c => c.ChartGroup).ToList();

            string selectedArea = "";

            switch (areaType)
            {
            case ComparisonArea.All:
                selectedArea = "All England";
                break;

            case ComparisonArea.LaCode:
            case ComparisonArea.LaName:
                selectedArea = _laService.GetLaName(laCode);
                break;
            }

            string schoolArea = "";

            if (benchmarkSchoolData != null)
            {
                schoolArea = _laService.GetLaName(benchmarkSchoolData.LaNumber.ToString());
            }

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(benchmarkCharts, base.ExtractSchoolComparisonListFromCookie(), chartGroups, comparisonType, benchmarkCriteria, simpleCriteria, benchmarkSchoolData, establishmentType, searchedEstabType, schoolArea, selectedArea, academiesTerm, maintainedTerm, areaType, laCode, urn, basketSize);

            ViewBag.Tab               = tab;
            ViewBag.ChartGroup        = chartGroup;
            ViewBag.UnitType          = defaultUnitType;
            ViewBag.HomeSchoolId      = vm.SchoolComparisonList.HomeSchoolUrn;
            ViewBag.EstablishmentType = vm.EstablishmentType;
            ViewBag.Financing         = financing;
            ViewBag.ChartFormat       = ChartFormat.Charts;

            return(View("Index", vm));
        }