Beispiel #1
0
 public void Update()
 {
     events             = project.EventsByType(eventType).Where(filter.IsVisible).ToList();
     homeEvents         = events.Where(e => project.EventTaggedTeam(e) == TeamType.LOCAL).ToList();
     awayEvents         = events.Where(e => project.EventTaggedTeam(e) == TeamType.VISITOR).ToList();
     TotalCount         = events.Count;
     LocalTeamCount     = homeEvents.Count;
     VisitorTeamCount   = awayEvents.Count;
     SubcategoriesStats = new List <SubCategoryStat> ();
     if (eventType is AnalysisEventType)
     {
         var tagsByGroup = (eventType as AnalysisEventType).TagsByGroup;
         foreach (string grp in tagsByGroup.Keys)
         {
             SubCategoryStat substat = new SubCategoryStat(grp);
             foreach (Tag t in tagsByGroup[grp])
             {
                 int count, localTeamCount, visitorTeamCount;
                 count            = events.Count(e => e.Tags.Contains(t));
                 localTeamCount   = homeEvents.Count(e => e.Tags.Contains(t));
                 visitorTeamCount = awayEvents.Count(e => e.Tags.Contains(t));
                 PercentualStat pStat = new PercentualStat(t.Value, count, localTeamCount,
                                                           visitorTeamCount, events.Count);
                 substat.OptionStats.Add(pStat);
             }
             SubcategoriesStats.Add(substat);
         }
     }
 }
		public void Update ()
		{
			events = filter.VisiblePlays.Where (e => e.Players.Contains (player) && e.EventType.Equals (EventType)).ToList ();
			
			SubcategoriesStats = new List<SubCategoryStat> ();

			if (EventType is ScoreEventType) {
				// Total number of points
				TotalCount = events.Sum (e => (e as ScoreEvent).Score.Points);
				int eventsCount = events.Count ();
				SubCategoryStat substat = new SubCategoryStat (Catalog.GetString ("Score"));
				// Create percentual stats for each score subtype. The count here is the number of events not points.
				foreach (Score score in project.Scores) {
					var scores = events.Where (e => (e as ScoreEvent).Score == score);
					PercentualStat pStat = new PercentualStat (score.Name, scores.Count (), 0, 0, eventsCount);
					substat.OptionStats.Add (pStat);
				}
				SubcategoriesStats.Add (substat);
			} else if (EventType is PenaltyCardEventType) {
				TotalCount = events.Count;
				SubCategoryStat substat = new SubCategoryStat (Catalog.GetString ("Penalties"));
				foreach (PenaltyCard penalty in project.PenaltyCards) {
					var penalties = events.Where (e => (e as PenaltyCardEvent).PenaltyCard == penalty);
					PercentualStat pStat = new PercentualStat (penalty.Name, penalties.Count (), 0, 0, TotalCount);
					substat.OptionStats.Add (pStat);
				}
				SubcategoriesStats.Add (substat);
			} else {
				AnalysisEventType evType = EventType as AnalysisEventType;
				TotalCount = events.Count;
				
				SubcategoriesStats = new List<SubCategoryStat> ();
				var tagsByGroup = evType.TagsByGroup;
				foreach (string grp in tagsByGroup.Keys) {
					SubCategoryStat substat = new SubCategoryStat (grp);
					foreach (Tag t in tagsByGroup[grp]) {
						int count;
						count = events.Count (e => e.Tags.Contains (t));
						PercentualStat pStat = new PercentualStat (t.Value, count, 0, 0, events.Count);
						substat.OptionStats.Add (pStat);
					}
					SubcategoriesStats.Add (substat);
				}
			}
			
		}
        public void Update()
        {
            events = filter.VisiblePlays.Where(e => ((LMTimelineEvent)e).Players.Contains(player) &&
                                               e.EventType.Equals(EventType)).Cast <LMTimelineEvent> ().ToList();

            SubcategoriesStats = new List <SubCategoryStat> ();

            if (EventType is ScoreEventType)
            {
                ScoreEventType scoreEventType = EventType as ScoreEventType;
                // Total number of points
                TotalCount = events.Count * scoreEventType.Score.Points;
                int eventsCount = events.Count();
            }
            else if (EventType is PenaltyCardEventType)
            {
                TotalCount = events.Count;
            }
            else
            {
                AnalysisEventType evType = EventType as AnalysisEventType;
                TotalCount = events.Count;

                SubcategoriesStats = new List <SubCategoryStat> ();
                var tagsByGroup = evType.TagsByGroup;
                foreach (string grp in tagsByGroup.Keys)
                {
                    SubCategoryStat substat = new SubCategoryStat(grp);
                    foreach (Tag t in tagsByGroup[grp])
                    {
                        int count;
                        count = events.Count(e => e.Tags.Contains(t));
                        PercentualStat pStat = new PercentualStat(t.Value, count, 0, 0, events.Count);
                        substat.OptionStats.Add(pStat);
                    }
                    SubcategoriesStats.Add(substat);
                }
            }
        }
Beispiel #4
0
 void CreateGroupStats(Dictionary <string, List <Tag> > tagsByGroup, bool forceInclude = true)
 {
     foreach (string grp in tagsByGroup.Keys)
     {
         bool            hasData = false;
         SubCategoryStat substat = new SubCategoryStat(grp);
         foreach (Tag t in tagsByGroup[grp])
         {
             int count, localTeamCount, visitorTeamCount;
             count            = events.Count(e => e.Tags.Contains(t));
             localTeamCount   = homeEvents.Count(e => e.Tags.Contains(t));
             visitorTeamCount = awayEvents.Count(e => e.Tags.Contains(t));
             PercentualStat pStat = new PercentualStat(t.Value, count, localTeamCount, visitorTeamCount, TotalCount);
             substat.OptionStats.Add(pStat);
             hasData |= count > 0;
         }
         if (forceInclude || hasData)
         {
             SubcategoriesStats.Add(substat);
         }
     }
 }
        public void Update()
        {
            List <TimelineEvent> originalEventsByType = project.EventsByType(eventType);
            var eventsByType = new List <LMTimelineEvent> ();

            foreach (var eventType in originalEventsByType)
            {
                eventsByType.Add(eventType as LMTimelineEvent);
            }
            events     = eventsByType.Where(filter.IsVisible).ToList();
            homeEvents = events.Where(e => e.Teams.Contains(project.LocalTeamTemplate) ||
                                      e.Players.Intersect(project.LocalTeamTemplate.List).Any()).ToList();
            awayEvents = events.Where(e => e.Teams.Contains(project.VisitorTeamTemplate) ||
                                      e.Players.Intersect(project.VisitorTeamTemplate.List).Any()).ToList();
            TotalCount         = events.Count;
            LocalTeamCount     = homeEvents.Count;
            VisitorTeamCount   = awayEvents.Count;
            SubcategoriesStats = new List <SubCategoryStat> ();
            if (eventType is AnalysisEventType)
            {
                var tagsByGroup = (eventType as AnalysisEventType).TagsByGroup;
                foreach (string grp in tagsByGroup.Keys)
                {
                    SubCategoryStat substat = new SubCategoryStat(grp);
                    foreach (Tag t in tagsByGroup[grp])
                    {
                        int count, localTeamCount, visitorTeamCount;
                        count            = events.Count(e => e.Tags.Contains(t));
                        localTeamCount   = homeEvents.Count(e => e.Tags.Contains(t));
                        visitorTeamCount = awayEvents.Count(e => e.Tags.Contains(t));
                        PercentualStat pStat = new PercentualStat(t.Value, count, localTeamCount,
                                                                  visitorTeamCount, TotalCount);
                        substat.OptionStats.Add(pStat);
                    }
                    SubcategoriesStats.Add(substat);
                }
            }
        }
Beispiel #6
0
 double GetCount(PercentualStat stats, TeamType team)
 {
     switch (team) {
     case TeamType.NONE:
     case TeamType.BOTH:
         return stats.TotalCount;
     case TeamType.LOCAL:
         return stats.LocalTeamCount;
     case TeamType.VISITOR:
         return stats.VisitorTeamCount;
     }
     return 0;
 }
Beispiel #7
0
 public void Update()
 {
     events = project.EventsByType (eventType).Where (filter.IsVisible).ToList ();
     homeEvents = events.Where (e => project.EventTaggedTeam (e) == TeamType.LOCAL).ToList ();
     awayEvents = events.Where (e => project.EventTaggedTeam (e) == TeamType.VISITOR).ToList ();
     TotalCount = events.Count;
     LocalTeamCount = homeEvents.Count;
     VisitorTeamCount = awayEvents.Count;
     SubcategoriesStats = new List<SubCategoryStat> ();
     if (eventType is AnalysisEventType) {
         var tagsByGroup = (eventType as AnalysisEventType).TagsByGroup;
         foreach (string grp in tagsByGroup.Keys) {
             SubCategoryStat substat = new SubCategoryStat (grp);
             foreach (Tag t in tagsByGroup[grp]) {
                 int count, localTeamCount, visitorTeamCount;
                 count = events.Count (e => e.Tags.Contains (t));
                 localTeamCount = homeEvents.Count (e => e.Tags.Contains (t));
                 visitorTeamCount = awayEvents.Count (e => e.Tags.Contains (t));
                 PercentualStat pStat = new PercentualStat (t.Value, count, localTeamCount,
                                            visitorTeamCount, events.Count);
                 substat.OptionStats.Add (pStat);
             }
             SubcategoriesStats.Add (substat);
         }
     }
 }
        public void Update()
        {
            events = filter.VisiblePlays.Where (e => ((TimelineEventLongoMatch)e).Players.Contains (player) &&
            e.EventType.Equals (EventType)).Cast<TimelineEventLongoMatch> ().ToList ();

            SubcategoriesStats = new List<SubCategoryStat> ();

            if (EventType is ScoreEventType) {
                ScoreEventType scoreEventType = EventType as ScoreEventType;
                // Total number of points
                TotalCount = events.Count * scoreEventType.Score.Points;
                int eventsCount = events.Count ();
            } else if (EventType is PenaltyCardEventType) {
                TotalCount = events.Count;
            } else {
                AnalysisEventType evType = EventType as AnalysisEventType;
                TotalCount = events.Count;

                SubcategoriesStats = new List<SubCategoryStat> ();
                var tagsByGroup = evType.TagsByGroup;
                foreach (string grp in tagsByGroup.Keys) {
                    SubCategoryStat substat = new SubCategoryStat (grp);
                    foreach (Tag t in tagsByGroup[grp]) {
                        int count;
                        count = events.Count (e => e.Tags.Contains (t));
                        PercentualStat pStat = new PercentualStat (t.Value, count, 0, 0, events.Count);
                        substat.OptionStats.Add (pStat);
                    }
                    SubcategoriesStats.Add (substat);
                }
            }
        }
 public void Update()
 {
     List<TimelineEvent> originalEventsByType = project.EventsByType (eventType);
     var eventsByType = new List<TimelineEventLongoMatch> ();
     foreach (var eventType in originalEventsByType) {
         eventsByType.Add (eventType as TimelineEventLongoMatch);
     }
     events = eventsByType.Where (filter.IsVisible).ToList ();
     homeEvents = events.Where (e => e.Teams.Contains (project.LocalTeamTemplate) ||
     e.Players.Intersect (project.LocalTeamTemplate.List).Any ()).ToList ();
     awayEvents = events.Where (e => e.Teams.Contains (project.VisitorTeamTemplate) ||
     e.Players.Intersect (project.VisitorTeamTemplate.List).Any ()).ToList ();
     TotalCount = events.Count;
     LocalTeamCount = homeEvents.Count;
     VisitorTeamCount = awayEvents.Count;
     SubcategoriesStats = new List<SubCategoryStat> ();
     if (eventType is AnalysisEventType) {
         var tagsByGroup = (eventType as AnalysisEventType).TagsByGroup;
         foreach (string grp in tagsByGroup.Keys) {
             SubCategoryStat substat = new SubCategoryStat (grp);
             foreach (Tag t in tagsByGroup[grp]) {
                 int count, localTeamCount, visitorTeamCount;
                 count = events.Count (e => e.Tags.Contains (t));
                 localTeamCount = homeEvents.Count (e => e.Tags.Contains (t));
                 visitorTeamCount = awayEvents.Count (e => e.Tags.Contains (t));
                 PercentualStat pStat = new PercentualStat (t.Value, count, localTeamCount,
                                            visitorTeamCount, TotalCount);
                 substat.OptionStats.Add (pStat);
             }
             SubcategoriesStats.Add (substat);
         }
     }
 }