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); }
private static void FoundsByFoundDate(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator) { htmlGenerator.AddTableSection( foundLogs.OrderBy(f => f.FoundDate), "Logs by Found Date", "ByFoundDate", ShortInfoTableSpec); }
private static void FoundsByPlacedDate(IEnumerable <GeocacheLog> foundLogs, HtmlGenerator htmlGenerator) { htmlGenerator.AddTableSection( foundLogs.OrderBy(f => f.Placed), "Logs by Placed Date", "ByPlacedDate", FullInfoTableSpec); }
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")); }
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")); }
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")); }
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); }