Exemple #1
0
        private static void AnniversaryFounds(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator)
        {
            var anniversaryList = foundLogs
                                  .OrderBy(f => f.FoundDate)
                                  .Where((l, i) => i == 0 || (i + 1) % 100 == 0);

            htmlGenerator.AddTableSection(anniversaryList, "Every 100th Found", "Every100thFound", ShortInfoTableSpec);
        }
Exemple #2
0
 private static void FoundsByFoundDate(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator)
 {
     htmlGenerator.AddTableSection(
         foundLogs.OrderBy(f => f.FoundDate),
         "Logs by Found Date",
         "ByFoundDate",
         ShortInfoTableSpec);
 }
Exemple #3
0
 private static void FoundsByPlacedDate(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator)
 {
     htmlGenerator.AddTableSection(
         foundLogs.OrderBy(f => f.Placed),
         "Logs by Placed Date",
         "ByPlacedDate",
         FullInfoTableSpec);
 }
Exemple #4
0
        private static void FoundsByCountry(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator)
        {
            var countryStats = foundLogs
                               .GroupBy(l => l.Country)
                               .Select(x => new SimpleStat(x.Key, x.Count()))
                               .OrderByDescending(s => s.Founds);

            htmlGenerator.AddTableSection(countryStats, "Founds by Country", "FoundsByCountry", GetSimpleStatSpec("Country"));
        }
Exemple #5
0
        private static void FoundsByState(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator)
        {
            var stateStats = foundLogs
                             .Where(l => l.Country == "Germany")
                             .GroupBy(l => l.State)
                             .Select(x => new SimpleStat(x.Key, x.Count()))
                             .OrderByDescending(s => s.Founds);

            htmlGenerator.AddTableSection(
                stateStats,
                "Founds by 'Bundesland'",
                "FoundsByBundesland",
                GetSimpleStatSpec("Bundesland"));
        }
Exemple #6
0
        private static void FoundsByOwner(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator)
        {
            var ownerStats = foundLogs
                             .GroupBy(l => l.PlacedBy)
                             .Select(x => new SimpleStat(x.Key, x.Count()))
                             .Where(x => x.Founds >= 5)
                             .OrderByDescending(s => s.Founds);

            htmlGenerator.AddTableSection(
                ownerStats,
                "Founds by Owner (five and more founds)",
                "FoundsByOwner",
                GetSimpleStatSpec("Owner"));
        }
Exemple #7
0
        private static void FarthestAwayFoundsByCardinalDirection(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator)
        {
            // Farthest away founds by cardinal direction
            GeocacheLog maxNorth = null;
            GeocacheLog maxSouth = null;
            GeocacheLog maxEast  = null;
            GeocacheLog maxWest  = null;

            foreach (var geocacheLog in foundLogs)
            {
                if (maxNorth == null || maxNorth.GeoLocation.Lat < geocacheLog.GeoLocation.Lat)
                {
                    maxNorth = geocacheLog;
                }
                if (maxSouth == null || maxSouth.GeoLocation.Lat > geocacheLog.GeoLocation.Lat)
                {
                    maxSouth = geocacheLog;
                }
                if (maxEast == null || maxEast.GeoLocation.Lon < geocacheLog.GeoLocation.Lon)
                {
                    maxEast = geocacheLog;
                }
                if (maxWest == null || maxWest.GeoLocation.Lon > geocacheLog.GeoLocation.Lon)
                {
                    maxWest = geocacheLog;
                }
            }

            var stats = new List <SimpleLogStat>
            {
                new SimpleLogStat("Farthest North", maxNorth),
                new SimpleLogStat("Farthest South", maxSouth),
                new SimpleLogStat("Farthest East", maxEast),
                new SimpleLogStat("Farthest West", maxWest)
            };

            htmlGenerator.AddTableSection(stats, "Cardinal Direction Maximums", "CardinalDirectionMaximums", SimpleLogStatTableSpec);
        }