fixed bug in search method popcorn-port
authorhamidouk
Thu, 24 Nov 2011 12:39:46 +0100
branchpopcorn-port
changeset 320 b693ba1a83be
parent 319 ad028d8c748b
child 321 21d840371c6b
fixed bug in search method
src/js/serializers/JSONSerializer.js
unittests/tests/serializers/JSONSerializer.js
--- a/src/js/serializers/JSONSerializer.js	Thu Nov 24 11:47:07 2011 +0100
+++ b/src/js/serializers/JSONSerializer.js	Thu Nov 24 12:39:46 2011 +0100
@@ -130,9 +130,10 @@
  
   for (i in this._data.annotations) {
     var annotation = this._data.annotations[i];
-    if (annotation.meta["id-ref"] == view_type && annotation.begin < currentTimeMs && annotation.end > currentTimeMs)
+    
+    if (annotation.meta["id-ref"] === view_type && annotation.begin <= currentTimeMs && annotation.end >= currentTimeMs)
       ret_array.push(annotation);
   }
-  
+
   return ret_array;
 };
--- a/unittests/tests/serializers/JSONSerializer.js	Thu Nov 24 11:47:07 2011 +0100
+++ b/unittests/tests/serializers/JSONSerializer.js	Thu Nov 24 12:39:46 2011 +0100
@@ -181,7 +181,22 @@
         "dc:modified": "2011-10-20T13:36:18.286693", 
         "dc:creator": "perso"
         } 
+      },
+      {"begin": 1234, "end" : 578900,
+       "content": {        
+        "description": "interview", 
+        "title": "lolol"
+        }, 
+       "id" : 2, 
+       "meta": {
+        "dc:contributor": "perso", 
+        "id-ref": "c_dfdfdfdf", 
+        "dc:created": "2011-10-20T13:36:18.286693", 
+        "dc:modified": "2011-10-20T13:36:18.286693", 
+        "dc:creator": "perso"
+        } 
       }
+ 
       ]};
 
       var ret = ser.currentAnnotations(234);