[longomatch] Fx period timenode when no stop is specified



commit 436fb2e102ec4dacc57c369c9f25b91c0862e297
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Jun 21 19:25:23 2014 +0200

    Fx period timenode when no stop is specified

 LongoMatch.Core/Store/Period.cs |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Core/Store/Period.cs b/LongoMatch.Core/Store/Period.cs
index 90d1b4d..8dbfd20 100644
--- a/LongoMatch.Core/Store/Period.cs
+++ b/LongoMatch.Core/Store/Period.cs
@@ -32,10 +32,15 @@ namespace LongoMatch.Store
                [JsonIgnore]
                public TimeNode PeriodNode {
                        get {
+                               Time start, stop;
+                               
+                               start = new Time (Nodes.Min (tn => tn.Start.MSeconds));
+                               stop = new Time (Nodes.Max (tn => tn.Stop != null ? tn.Stop.MSeconds : 0));
+                               if (stop.MSeconds == 0) {
+                                       stop = null;
+                               }
                                return new TimeNode {Name=Name,
-                                       Start = new Time (Nodes.Min (tn => tn.Start.MSeconds)),
-                                       Stop = new Time (Nodes.Max (tn => tn.Stop.MSeconds)),
-                               };
+                                       Start = start, Stop = stop};
                        }
                        set {
                                foreach (TimeNode tn in Nodes) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]