[chronojump] Fixes bug: the dialogue when importing a session always showed the first session of the database.



commit fcb29cb036c01a75c7e3a74ba119fc507808a6fb
Author: Carles Pina i Estany <carles pina cat>
Date:   Wed Nov 9 18:52:51 2016 +0100

    Fixes bug: the dialogue when importing a session always showed the first session of the database.
    
    Now it returns the session name which ID matches the uniqueID that the
    user is importing.

 src/chronojumpImporter.cs |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/chronojumpImporter.cs b/src/chronojumpImporter.cs
index 7cad699..96ece64 100644
--- a/src/chronojumpImporter.cs
+++ b/src/chronojumpImporter.cs
@@ -241,7 +241,9 @@ class ChronojumpImporter
 
                        foreach(JsonValue session in json["sessions"])
                        {
-                               return JsonUtils.valueOrDefault (session, "name", "UNKNOWN");
+                               if (session.ContainsKey ("uniqueID") && session ["uniqueID"] == sessionId) {
+                                       return JsonUtils.valueOrDefault (session, "name", "UNKNOWN");
+                               }
                        }
                        LogB.Information ("Trying to import a session that we can't find the name. Output:" + 
information.output);
                        return "UNKNOWN";


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