Esempio n. 1
0
        public ActionResult Index()
        {
            using (var dataSummary = new DataSummaryManager())
            {
                StatsModel model = new StatsModel();

                var dateTo   = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1).AddDays(-1);
                var dateFrom = dateTo.AddYears(-1);

                model.TopContributors   = dataSummary.GetTopNStats("UserPOIChangesLast90Days", 10, null);
                model.TopCommentators   = dataSummary.GetTopNStats("UserCommentsLast90Days", 10, null);
                model.TopMediaItems     = dataSummary.GetTopNStats("UserMediaLast90Days", 10, null);
                model.UserRegistrations = dataSummary.GetUserRegistrationStats(dateFrom, dateTo);
                model.UserEdits         = dataSummary.GetUserEditSummary(dateFrom, dateTo);
                model.UserComments      = dataSummary.GetUserCommentStats(dateFrom, dateTo);

                model.TotalActiveContributors  = dataSummary.GetStatSingle("TotalChangeContributorsLast90Days");
                model.TotalActiveEditors       = dataSummary.GetStatSingle("ActiveEditorsLast90Days");
                model.TotalCommentContributors = dataSummary.GetStatSingle("TotalCommentContributorsLast90Days");
                model.TotalPhotoContributors   = dataSummary.GetStatSingle("TotalPhotoContributorsLast90Days");

                var countryStats = dataSummary.GetAllCountryStats();
                model.TotalLocations = countryStats.Sum(c => c.LocationCount);
                model.TotalStations  = countryStats.Sum(c => c.StationCount);
                return(View(model));
            }
        }
        public ActionResult Index(string countryname)
        {
            if (!String.IsNullOrEmpty(countryname))
            {
                var country = new ReferenceDataManager().GetCountryByName(countryname);
                return(this.Summary(countryname));
            }

            //list of all countries
            var allCountries = new ReferenceDataManager().GetCountries(false);
            var countryStats = new DataSummaryManager().GetAllCountryStats();

            var continents = new Dictionary <string, string>();

            continents.Add("AS", "Asia");
            continents.Add("EU", "Europe");
            continents.Add("NA", "North America");
            continents.Add("OC", "Oceania");
            continents.Add("SA", "South America");
            continents.Add("AF", "Africa");

            ViewBag.Continents   = continents;
            ViewBag.CountryStats = countryStats;
            return(View(allCountries));
        }
Esempio n. 3
0
        public ActionResult Activity()
        {
            var summaryManager = new DataSummaryManager();
            var summary        = summaryManager.GetActivitySummary(new APIRequestParams());

            ViewBag.ShowPOILink = true;
            return(View(summary));
        }
Esempio n. 4
0
        public async Task <ActionResult> Activity()
        {
            using (var summaryManager = new DataSummaryManager())
            {
                var summary = await summaryManager.GetActivitySummary(new APIRequestParams());

                ViewBag.ShowPOILink = true;
                return(View(summary));
            }
        }
Esempio n. 5
0
        public void ProcessRequest(HttpContext context)
        {
            if (dataSummaryManager == null)
            {
                dataSummaryManager = new DataSummaryManager();
            }

            APIRequestSettings filterSettings = new APIRequestSettings();

            filterSettings.ParseParameters(filterSettings, context);

            string action = "totals_per_country";

            if (!String.IsNullOrEmpty(context.Request["action"]))
            {
                action = context.Request["action"].ToString();
            }

            if (action == "totals_per_country")
            {
                context.Response.ContentType = "application/javascript";
                context.Response.Write(dataSummaryManager.GetTotalsPerCountrySummary(true, "ocm_getdatasummary", filterSettings));
                context.Response.Flush();
            }

            if (action == "full_summary")
            {
                // Output JSON summary of:
                // - Current totals per country
                // - Total added (per country? based on date range, location/distance filter?)
                // - Total modified
                // - User Comments Count

                // - per month values, current month first? default last 12 months
            }

            if (action == "activity_summary")
            {
                // Based on date range, location and distance:
                // - list of recent comments, checkins, id & title etc of items added & modified
                var o = new JSONOutputProvider();

                context.Response.ContentType = o.ContentType;
                var summary = dataSummaryManager.GetActivitySummary(filterSettings);
                o.PerformSerialisationV2(context.Response.OutputStream, summary, filterSettings.Callback);

                context.Response.Flush();
            }
        }
Esempio n. 6
0
        public ActionResult Index()
        {
            var        dataSummary = new DataSummaryManager();
            StatsModel model       = new StatsModel();

            var dateTo   = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1).AddDays(-1);
            var dateFrom = dateTo.AddYears(-1);

            model.TopContributors   = dataSummary.GetTopNContributors(15, null);
            model.UserRegistrations = dataSummary.GetUserRegistrationStats(dateFrom, dateTo);
            model.UserEdits         = dataSummary.GetUserEditSummary(dateFrom, dateTo);
            model.UserComments      = dataSummary.GetUserCommentStats(dateFrom, dateTo);

            return(View(model));
        }