@@ -8,9 +8,10 @@ var DocumentRootMinichartView = require('./document-root');
8
8
var ArrayRootMinichartView = require ( './array-root' ) ;
9
9
var vizFns = require ( './d3fns' ) ;
10
10
var QueryBuilderMixin = require ( './querybuilder' ) ;
11
- var debug = require ( 'debug' ) ( 'scout:minicharts:index' ) ;
12
11
var Collection = require ( 'ampersand-collection' ) ;
13
12
13
+ // var debug = require('debug')('scout:minicharts:index');
14
+
14
15
var ArrayCollection = Collection . extend ( {
15
16
model : Array
16
17
} ) ;
@@ -57,7 +58,11 @@ module.exports = AmpersandView.extend(QueryBuilderMixin, {
57
58
}
58
59
return false ;
59
60
} ,
61
+ /* eslint complexity: 0 */
60
62
render : function ( ) {
63
+ var isGeo = false ;
64
+ var coords ;
65
+
61
66
this . renderWithTemplate ( this ) ;
62
67
63
68
if ( [ 'String' , 'Number' ] . indexOf ( this . model . name ) !== - 1
@@ -70,7 +75,6 @@ module.exports = AmpersandView.extend(QueryBuilderMixin, {
70
75
} else if ( this . model . name === 'Document' ) {
71
76
// are these coordinates? Do a basic check for now, until we support semantic schema types
72
77
// here we check for GeoJSON form: { loc: {type: "Point", "coordinates": [47.80, 9.63] } }
73
- var isGeo = false ;
74
78
if ( app . isFeatureEnabled ( 'Geo Minicharts' ) ) {
75
79
if ( this . model . fields . length === 2
76
80
&& this . model . fields . get ( 'type' )
@@ -81,7 +85,7 @@ module.exports = AmpersandView.extend(QueryBuilderMixin, {
81
85
=== this . model . fields . get ( 'coordinates' ) . count
82
86
&& this . model . fields . get ( 'coordinates' ) . types . get ( 'Array' ) . average_length === 2
83
87
) {
84
- var coords = this . _mangleGeoCoordinates (
88
+ coords = this . _mangleGeoCoordinates (
85
89
this . model . fields . get ( 'coordinates' ) . types . get ( 'Array' )
86
90
. types . get ( 'Number' ) . values . serialize ( ) ) ;
87
91
if ( coords ) {
@@ -103,13 +107,13 @@ module.exports = AmpersandView.extend(QueryBuilderMixin, {
103
107
this . subview = new DocumentRootMinichartView ( this . viewOptions ) ;
104
108
}
105
109
} else if ( this . model . name === 'Array' ) {
106
- var isGeo = false ;
110
+ isGeo = false ;
107
111
if ( app . isFeatureEnabled ( 'Geo Minicharts' ) ) {
108
112
// are these coordinates? Do a basic check for now, until we support semantic schema types
109
113
// here we check for legacy coordinates in array form: { loc: [47.80, 9.63] }
110
114
var lengths = this . model . lengths ;
111
115
if ( _ . min ( lengths ) === 2 && _ . max ( lengths ) === 2 ) {
112
- var coords = this . _mangleGeoCoordinates (
116
+ coords = this . _mangleGeoCoordinates (
113
117
this . model . types . get ( 'Number' ) . values . serialize ( ) ) ;
114
118
if ( coords ) {
115
119
this . model . values = coords ;
0 commit comments