[longomatch] Standarize Project API using Event instead of Play
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Standarize Project API using Event instead of Play
- Date: Wed, 18 Mar 2015 14:37:05 +0000 (UTC)
commit 11147c11d4c2797550a7ff734892c1adef73e5e6
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Mar 6 17:52:57 2015 +0100
Standarize Project API using Event instead of Play
LongoMatch.Core/Stats/EventTypeStats.cs | 4 ++--
LongoMatch.Core/Store/Project.cs | 16 ++++++++--------
LongoMatch.Drawing/CanvasObjects/PlayObject.cs | 2 +-
LongoMatch.Drawing/CanvasObjects/PositionObject.cs | 2 +-
.../Gui/Component/PlaysListTreeWidget.cs | 2 +-
LongoMatch.Plugins/CSVExporter.cs | 2 +-
LongoMatch.Services/Services/EventsManager.cs | 2 +-
Tests/Core/Store/TestProject.cs | 4 ++--
8 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/LongoMatch.Core/Stats/EventTypeStats.cs b/LongoMatch.Core/Stats/EventTypeStats.cs
index 56f5a48..affcfde 100644
--- a/LongoMatch.Core/Stats/EventTypeStats.cs
+++ b/LongoMatch.Core/Stats/EventTypeStats.cs
@@ -42,8 +42,8 @@ namespace LongoMatch.Core.Stats
public void Update ()
{
events = project.EventsByType (eventType).Where (filter.IsVisible).ToList ();
- homeEvents = events.Where (e => project.PlayTaggedTeam (e) == Team.LOCAL).ToList ();
- awayEvents = events.Where (e => project.PlayTaggedTeam (e) == Team.VISITOR).ToList ();
+ homeEvents = events.Where (e => project.EventTaggedTeam (e) == Team.LOCAL).ToList ();
+ awayEvents = events.Where (e => project.EventTaggedTeam (e) == Team.VISITOR).ToList
();
TotalCount = events.Count;
LocalTeamCount = homeEvents.Count;
VisitorTeamCount = awayEvents.Count;
diff --git a/LongoMatch.Core/Store/Project.cs b/LongoMatch.Core/Store/Project.cs
index b9d503e..d55ba30 100644
--- a/LongoMatch.Core/Store/Project.cs
+++ b/LongoMatch.Core/Store/Project.cs
@@ -144,7 +144,7 @@ namespace LongoMatch.Core.Store
public List<Score> Scores {
get {
var scores = Dashboard.List.OfType<ScoreButton> ().Select (b => b.Score);
- return ScorePlays.Select (e => e.Score).Union (scores).OrderByDescending
(s=>s.Points).ToList();
+ return ScoreEvents.Select (e => e.Score).Union (scores).OrderByDescending
(s=>s.Points).ToList();
}
}
@@ -152,26 +152,26 @@ namespace LongoMatch.Core.Store
public List<PenaltyCard> PenaltyCards {
get {
var pc = Dashboard.List.OfType<PenaltyCardButton> ().Select (b =>
b.PenaltyCard);
- return PenaltyCardsPlays.Select (e => e.PenaltyCard).Union (pc).ToList();
+ return PenaltyCardsEvents.Select (e => e.PenaltyCard).Union (pc).ToList();
}
}
[JsonIgnore]
- public List<ScoreEvent> ScorePlays {
+ public List<ScoreEvent> ScoreEvents {
get {
return Timeline.OfType<ScoreEvent>().Select (t => t).ToList();
}
}
[JsonIgnore]
- public List<PenaltyCardEvent> PenaltyCardsPlays {
+ public List<PenaltyCardEvent> PenaltyCardsEvents {
get {
return Timeline.OfType<PenaltyCardEvent>().Select (t => t).ToList();
}
}
[JsonIgnore]
- public IEnumerable<IGrouping<EventType, TimelineEvent>> PlaysGroupedByEventType {
+ public IEnumerable<IGrouping<EventType, TimelineEvent>> EventsGroupedByEventType {
get {
return Timeline.GroupBy(play => play.EventType);
}
@@ -275,7 +275,7 @@ namespace LongoMatch.Core.Store
/// <param name="section">
/// A <see cref="System.Int32"/>: category the play belongs to
/// </param>
- public void RemovePlays (List<TimelineEvent> plays)
+ public void RemoveEvents (List<TimelineEvent> plays)
{
bool updateScore = false;
@@ -431,10 +431,10 @@ namespace LongoMatch.Core.Store
}
public int GetScore (Team team) {
- return Timeline.OfType<ScoreEvent>().Where (s => PlayTaggedTeam (s) == team).Sum(s =>
s.Score.Points);
+ return Timeline.OfType<ScoreEvent>().Where (s => EventTaggedTeam (s) == team).Sum(s
=> s.Score.Points);
}
- public Team PlayTaggedTeam (TimelineEvent play) {
+ public Team EventTaggedTeam (TimelineEvent play) {
bool home=false, away=false;
if (play.Team == Team.LOCAL || play.Team == Team.BOTH ||
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
index 2279433..8fddc3b 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
@@ -89,7 +89,7 @@ namespace LongoMatch.Drawing.CanvasObjects
double y1, y2;
tk.LineWidth = lineWidth;
- team = Project.PlayTaggedTeam (Play);
+ team = Project.EventTaggedTeam (Play);
if (team == Team.LOCAL) {
color = Project.LocalTeamTemplate.Color;
} else if (team == Team.VISITOR) {
diff --git a/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
b/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
index 9f53479..b82894c 100644
--- a/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
@@ -145,7 +145,7 @@ namespace LongoMatch.Drawing.CanvasObjects
fillColor = Play.Color;
strokeColor = fillColor;
if (Project != null) {
- Team team = Project.PlayTaggedTeam (Play);
+ Team team = Project.EventTaggedTeam (Play);
if (team == Team.LOCAL) {
strokeColor = Project.LocalTeamTemplate.Color;
} else if (team == Team.VISITOR) {
diff --git a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
index cd8cd55..75346ab 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
@@ -133,7 +133,7 @@ namespace LongoMatch.Gui.Component
itersDic.Add (evType, iter);
}
- var queryPlaysByCategory = project.PlaysGroupedByEventType;
+ var queryPlaysByCategory = project.EventsGroupedByEventType;
foreach (var playsGroup in queryPlaysByCategory) {
EventType cat = playsGroup.Key;
if (!itersDic.ContainsKey (cat))
diff --git a/LongoMatch.Plugins/CSVExporter.cs b/LongoMatch.Plugins/CSVExporter.cs
index 3d8a1f0..f55ef43 100644
--- a/LongoMatch.Plugins/CSVExporter.cs
+++ b/LongoMatch.Plugins/CSVExporter.cs
@@ -138,7 +138,7 @@ namespace LongoMatch.Plugins
play.EventTime == null ? "" :
play.EventTime.ToMSecondsString(),
play.Start.ToMSecondsString(),
play.Stop.ToMSecondsString(),
- TeamName(project.PlayTaggedTeam(play)),
+ TeamName(project.EventTaggedTeam(play)),
String.Join (" | ", play.Players));
if (evt is ScoreEventType) {
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index f280694..bb6a360 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -115,7 +115,7 @@ namespace LongoMatch.Services
{
Log.Debug (plays.Count + " plays deleted");
analysisWindow.DeletePlays (plays);
- openedProject.RemovePlays (plays);
+ openedProject.RemoveEvents (plays);
if (projectType == ProjectType.FileProject) {
Save (openedProject);
}
diff --git a/Tests/Core/Store/TestProject.cs b/Tests/Core/Store/TestProject.cs
index 6f8b1d6..bdf5dd0 100644
--- a/Tests/Core/Store/TestProject.cs
+++ b/Tests/Core/Store/TestProject.cs
@@ -120,7 +120,7 @@ namespace Tests.Core.Store
public void TestEventsGroupedByEventType ()
{
Project p = CreateProject ();
- var g = p.PlaysGroupedByEventType;
+ var g = p.EventsGroupedByEventType;
Assert.AreEqual (g.Count (), 4);
var gr = g.ElementAt (0);
Assert.AreEqual (p.EventTypes[0], gr.Key);
@@ -184,7 +184,7 @@ namespace Tests.Core.Store
p.AddEvent (p3);
plays.Add (p1);
plays.Add (p2);
- p.RemovePlays (plays);
+ p.RemoveEvents (plays);
Assert.AreEqual (p.Timeline.Count, 1);
Assert.AreEqual (p.Timeline [0], p3);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]