cms/app-client/app/serializers/transcript.js
changeset 264 e0fc9f698b9b
parent 258 12c694392e8e
child 454 710a2ae08a74
--- a/cms/app-client/app/serializers/transcript.js	Wed Aug 24 09:46:03 2016 +0200
+++ b/cms/app-client/app/serializers/transcript.js	Wed Aug 24 15:01:54 2016 +0200
@@ -51,7 +51,7 @@
                 annotations.push(object);
             }
             if(!translationISO && annotation['content']['data']['transl']) {
-                translationISO = annotation['content']['data']['transl']['@language'];    
+                translationISO = annotation['content']['data']['transl']['@language'];
             }
         });
 
@@ -72,8 +72,8 @@
             annotations = types;
         }
 
+        var sections = [];
         if(payload['lists'].length) {
-            var sections = [];
             var lists = [];
             payload['lists'].forEach(function(list) {
                 var topic = topics['content']['data'].find(topic => topic.id === list['meta']['corpus:topic']['id-ref']);
@@ -85,7 +85,6 @@
                 lists.push(annotations.filter(annotation => annotation['begin'] >= list['meta']['corpus:begin'] && annotation['end'] <= list['meta']['corpus:end']));
             });
             annotations = lists;
-            console.log(sections);
         } else {
             annotations = [annotations];
         }
@@ -101,7 +100,7 @@
             }
         };
 
-        if(sections) {
+        if(sections.length) {
             response.data.attributes.sections = sections;
         }
 
@@ -113,7 +112,7 @@
             var translation = payload['meta']['dc:title'].find(function(title) { return title['@language'] === translationISO; });
             if(translation) {
                 response.data.attributes.title.translation = translation['@value'];
-            }            
+            }
         } else {
             response.data.attributes.title.original = payload['meta']['dc:title']['@value'];
         }