Ejemplo n.º 1
0
        public static Timeseries GetMonthlyAverages(string identityName)
        {
            var repo       = new RegistryEntryRepoFactory().GetRegistryEntryRepo(identityName);
            var sortedTvqs = repo.GetRegistryEntries().OrderBy(x => x.Time);

            var tsWithRegisterEntries = new Timeseries();

            tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

            var periodizer      = new Periodizer();
            var monthlyAverages = periodizer.MonthlyAverage(tsWithRegisterEntries);

            //const int minMonths = 2;
            //var tooFewEntries = monthlyRegisterEntries.Count < minMonths;
            //var areTooFewEntries = tooFewEntries;
            //if (areTooFewEntries)
            //{
            //    throw new TooFewEntriesException(minMonths);
            //}

            //var deltaOperator = new DeltaTsOperator();
            //var monthlyAverages = deltaOperator.Apply(monthlyRegisterEntries);

            return(monthlyAverages);
        }
Ejemplo n.º 2
0
        public ActionResult ListEntriesView()
        {
            try
            {
                var repo = new RegistryEntryRepoFactory().GetRegistryEntryRepo();

                var entries = repo.GetRegistryEntries(Thread.CurrentPrincipal);
                var sortedTvqs = entries.OrderBy(x => x.Time);
                var tsWithRegisterEntries = new Timeseries();
                tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

                return View(tsWithRegisterEntries);
            }
            catch (Exception e)
            {
                _logger.TrackException(e);
                return View("Error");
            }
        }
Ejemplo n.º 3
0
        public ActionResult ListEntriesView()
        {
            try
            {
                var repo = new RegistryEntryRepoFactory().GetRegistryEntryRepo(User.Identity.Name);

                var entries               = repo.GetRegistryEntries();
                var sortedTvqs            = entries.OrderBy(x => x.Time);
                var tsWithRegisterEntries = new Timeseries();
                tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

                return(View(tsWithRegisterEntries));
            }
            catch (Exception e)
            {
                _logger.TrackException(e);
                return(View("Error"));
            }
        }
Ejemplo n.º 4
0
        public static Timeseries GetMonthlyAverages()
        {
            var repo = new RegistryEntryRepoFactory().GetRegistryEntryRepo();
            var sortedTvqs = repo.GetRegistryEntries(Thread.CurrentPrincipal).OrderBy(x => x.Time);

            var tsWithRegisterEntries = new Timeseries();
            tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

            var periodizer = new Periodizer();
            var monthlyRegisterEntries = periodizer.MonthlyAverage(tsWithRegisterEntries);

            const int minMonths = 2;
            var tooFewEntries = monthlyRegisterEntries.Count < minMonths;
            var areTooFewEntries = tooFewEntries;
            if (areTooFewEntries)
            {
                throw new TooFewEntriesException(minMonths);
            }

            var deltaOperator = new DeltaTsOperator();
            var monthlyAverages = deltaOperator.Apply(monthlyRegisterEntries);

            return monthlyAverages;
        }