Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
AnalyticsModuleRacesAges.cs
7
9{
14 {
15 #region Model
16 public class ModelRaceAges
17 {
18 public int RaceID { get; set; }
19 public List<ushort> BirthYears { get; set; }
20 }
21
22 #endregion
23
24 private IRaceService _raceService;
25
31 {
32 _raceService = raceService;
33 }
34
38 public bool AnalyticsAvailable => _raceService?.PersistedRacesVariant != null;
39
43 public List<ModelRaceAges> AgeListsPerRace => _raceService.PersistedRacesVariant?.Races.Select((race, index) => new ModelRaceAges()
44 {
45 RaceID = race.RaceID,
46 BirthYears = race.Starts.Where(s => s.IsActive).Select(s => s.PersonObj.BirthYear).OrderBy(b => b).ToList()
47 }).ToList();
48
51 {
52 DocXPlaceholderHelper.TextPlaceholders textPlaceholder = new DocXPlaceholderHelper.TextPlaceholders();
53 // Create a string for each list entry (Format e.g.: Race 1: 2000, 2010, 2015)
54 string placeholderString = string.Join(Environment.NewLine,
56 .Select(e => $"{Properties.Resources.RaceString} {e.RaceID.ToString().PadLeft(2)}: {string.Join(", ", e.BirthYears)}"));
57 foreach (string placeholder in Placeholders.Placeholders_AnalyticsRacesAges) { textPlaceholder.Add(placeholder, placeholderString); }
58 return textPlaceholder;
59 }
60
62 public List<string> SupportedDocumentPlaceholderKeys => new List<string>()
63 {
64 Placeholders.PLACEHOLDER_KEY_ANALYTICS_RACES_AGES
65 };
66
67 }
68}
Analytics module to calculate the age distribution over the result places.
DocXPlaceholderHelper.TextPlaceholders CollectDocumentPlaceholderContents()
Collect the values for all document placeholders that are supported by this IAnalyticsModule....
AnalyticsModuleRacesAges(IRaceService raceService)
Constructor for the AnalyticsModuleRacesAges
bool AnalyticsAvailable
This analytics is only available, when a persisted race is available.
List< string > SupportedDocumentPlaceholderKeys
List of all document placeholder keys that are supported by this analytics module....
List< ModelRaceAges > AgeListsPerRace
List with ModelRaceAgeSpan ordered by the race id and the birth year inside the corresponding list.
Interface for a service used to manage Race and RacesVariant objects.