public ActionResult GlobalStatistics(StatisticDetailsViewModel details)
        {
            var exams = _db.Exams.Where(e => e.Active).ToList();

            foreach (var exam in exams)
            {
                var responses = exam.Responses.ToList();
                foreach (var response in responses)
                {
                    foreach (var answer in response.Answers.ToArray())
                    {
                        var multipleAnswer = answer as MultipleSelectionAnswer;
                        if (multipleAnswer != null)
                        {
                            response.Answers.Remove(answer);
                            response.Answers.Add(_db.MultipleSelectionAnswers
                                                 .Include(a => a.Selections)
                                                 .SingleOrDefault(e => e.QuestionId == answer.QuestionId && e.ResponseId == answer.ResponseId));
                        }
                    }
                }
                exam.Responses = responses;
            }

            var model = new GlobalStatisticsViewModel(exams, details.StartDate, details.EndDate);

            return(View(model));
        }
Esempio n. 2
0
        public AnalysisViewModel(MultiAlignAnalysis analysis)
        {
            m_showDriftTime = false;

            LoadDatasets(analysis);

            // Create matching clusters and AMT Matches.
            var matches  = analysis.DataProviders.MassTagMatches.FindAll();
            var clusters =
                analysis.Clusters.MapMassTagsToClusters(matches, analysis.MassTagDatabase);

            // Cache the clusters so that they can be readily accessible later on.
            // This will help speed up performance, so that we dont have to hit the database
            // when we want to find matching mass tags, and dont have to map clusters to tags multiple times.
            FeatureCacheManager <UMCClusterLightMatched> .SetFeatures(clusters.Item1);

            FeatureCacheManager <MassTagToCluster> .SetFeatures(clusters.Item2);

            SingletonDataProviders.Providers = analysis.DataProviders;


            // Create sub-view models
            MassTags                       = new ObservableCollection <MassTagToCluster>(clusters.Item2);
            ClusterTree                    = new UmcClusterCollectionTreeViewModel(clusters.Item1);
            ClusterSpectraViewModel        = new UmcClusterSpectraViewModel();
            ClusterIdentificationViewModel = new UMCClusterIdentificationViewModel();
            AnalysisOptionsViewModel       = new AnalysisOptionsViewModel(analysis.Options);
            ClusterViewModel               = new ClusterDetailViewModel();

            var charges = SingletonDataProviders.Providers.FeatureCache.RetrieveChargeStates();

            GlobalStatisticsViewModel = new GlobalStatisticsViewModel(clusters.Item1, charges);
            HasIdentifications        = (MassTags.Count > 0);


            SelectedClusterName = "Cluster Details:";
            LoadClusters(clusters.Item1);
            ApplyViewAsFilter = new BaseCommand(FilterFromView);
        }