fixed stupid bug due to convoluted function popcorn-port
authorhamidouk
Wed, 18 Jan 2012 16:16:21 +0100
branchpopcorn-port
changeset 666 08d1656c608a
parent 665 372852c77e6d
child 667 2407ecee1169
fixed stupid bug due to convoluted function
src/js/serializers/JSONSerializer.js
--- a/src/js/serializers/JSONSerializer.js	Wed Jan 18 14:51:50 2012 +0100
+++ b/src/js/serializers/JSONSerializer.js	Wed Jan 18 16:16:21 2012 +0100
@@ -92,22 +92,23 @@
     /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either
        null or undefined.
     */
-    var view;
-
-    if (typeof(this._data.views) !== "undefined" && this._data.views !== null)
-       view = this._data.views[0];
+    
+    var searchViewType = this.getTweets();
+    if (typeof(searchViewType) === "undefined") {
+      var view;
+      
+      if (typeof(this._data.views) !== "undefined" && this._data.views !== null)
+         view = this._data.views[0];    
 
-    var searchViewType = "";
-
-    if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) {
-            searchViewType = view.annotation_types[0];
+      if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) {
+              searchViewType = view.annotation_types[0];
+      }
     }
-
     var filterfn = function(annotation) {
       if( searchViewType  != "" && 
           typeof(annotation.meta) !== "undefined" && 
           typeof(annotation.meta["id-ref"]) !== "undefined" &&
-          annotation.meta["id-ref"] !== searchViewType) {
+          annotation.meta["id-ref"] === searchViewType) {
         return false; // pass
       } else {
           return true;