[longomatch] When generating score event subcategories we only sum points for the TotalCount. Percentual stats sh
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] When generating score event subcategories we only sum points for the TotalCount. Percentual stats sh
- Date: Wed, 26 Nov 2014 11:20:22 +0000 (UTC)
commit 02486b972f9bf335b93249630ec1ee01aa6120cd
Author: Julien Moutte <julien fluendo com>
Date: Tue Nov 25 18:27:36 2014 +0100
When generating score event subcategories we only sum points for the TotalCount. Percentual stats should
analyse the number of occurence.
LongoMatch.Core/Stats/PlayerEventTypeStats.cs | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/LongoMatch.Core/Stats/PlayerEventTypeStats.cs b/LongoMatch.Core/Stats/PlayerEventTypeStats.cs
index fe8f672..8df9591 100644
--- a/LongoMatch.Core/Stats/PlayerEventTypeStats.cs
+++ b/LongoMatch.Core/Stats/PlayerEventTypeStats.cs
@@ -56,17 +56,14 @@ namespace LongoMatch.Core.Stats
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) {
- int count;
var scores = events.Where (e => (e as ScoreEvent).Score == score);
- if (score.Points == 0) {
- count = scores.Count ();
- } else {
- count = scores.Sum (e => (e as ScoreEvent).Score.Points);
- }
- PercentualStat pStat = new PercentualStat (score.Name, count, 0, 0,
TotalCount);
+ PercentualStat pStat = new PercentualStat (score.Name, scores.Count
(), 0, 0, eventsCount);
substat.OptionStats.Add (pStat);
}
SubcategoriesStats.Add (substat);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]