Compare commits

..

8 Commits

Author SHA1 Message Date
Raul Ochoa
c09cda84a3 Release 2.53.5 2016-06-29 16:49:34 +02:00
Raul Ochoa
bd36ea1829 news style 2016-06-29 16:49:13 +02:00
Raul Ochoa
01a47925e0 Merge pull request #529 from CartoDB/528-invalid-error-regression
Fixes invalid error on node not found from dataview
2016-06-29 16:47:16 +02:00
Raul Ochoa
dd8a70eb95 Uses node list so identical nodes are not de-duplicated and can be used with different ids
Fixes #528
2016-06-29 16:10:26 +02:00
Raul Ochoa
013bdba4ff Add regression test wheren node id can't be found and it should 2016-06-29 16:08:38 +02:00
Raul Ochoa
c1acc54d55 Add constants for cartocss symbolizers 2016-06-29 16:07:42 +02:00
Raul Ochoa
5f3fb6e5f7 Adds fake CDB_KMeans function 2016-06-29 16:07:01 +02:00
Raul Ochoa
cb53d140e3 Stubs next version 2016-06-28 19:48:47 +02:00
8 changed files with 168 additions and 5 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## 2.53.5
Released 2016-06-29
Bug fixes:
- Uses node list so identical nodes are not de-duplicated and can be used with different ids #528.
## 2.53.4
Released 2016-06-28

View File

@@ -85,7 +85,7 @@ DataviewBackend.prototype.getDataview = function (mapConfigProvider, user, param
sourceId2Node[rootNode.params.id] = rootNode;
}
analysis.getSortedNodes().forEach(function(node) {
analysis.getNodes().forEach(function(node) {
if (node.params && node.params.id) {
sourceId2Node[node.params.id] = node;
}
@@ -232,7 +232,7 @@ DataviewBackend.prototype.search = function (mapConfigProvider, user, params, ca
sourceId2Node[rootNode.params.id] = rootNode;
}
analysis.getSortedNodes().forEach(function(node) {
analysis.getNodes().forEach(function(node) {
if (node.params && node.params.id) {
sourceId2Node[node.params.id] = node;
}

View File

@@ -92,7 +92,7 @@ AnalysisMapConfigAdapter.prototype.getMapConfig = function(user, requestMapConfi
sourceId2Query[rootNode.params.id] = rootNode;
}
analysis.getSortedNodes().forEach(function(node) {
analysis.getNodes().forEach(function(node) {
if (node.params && node.params.id) {
sourceId2Query[node.params.id] = node;
}

2
npm-shrinkwrap.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "windshaft-cartodb",
"version": "2.53.4",
"version": "2.53.5",
"dependencies": {
"body-parser": {
"version": "1.14.2",

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "windshaft-cartodb",
"version": "2.53.4",
"version": "2.53.5",
"description": "A map tile server for CartoDB",
"keywords": [
"cartodb"

View File

@@ -0,0 +1,107 @@
require('../../support/test_helper');
var assert = require('../../support/assert');
var TestClient = require('../../support/test-client');
describe('analysis-layers error cases', function() {
it('should handle missing analysis nodes for layers', function(done) {
var mapConfig = {
"version": "1.5.0",
"layers": [
{
"type": "cartodb",
"options": {
"cartocss": TestClient.CARTOCSS.POINTS,
"cartocss_version": "2.1.1",
"interactivity": [],
"source": {
"id": "a4"
}
}
},
{
"type": "cartodb",
"options": {
"cartocss": TestClient.CARTOCSS.POINTS,
"cartocss_version": "2.1.0",
"interactivity": [],
"source": {
"id": "b1"
}
}
}
],
"dataviews": {
"74493a30-4679-4b72-a60c-b6f808b57c98": {
"type": "histogram",
"source": {
"id": "b0"
},
"options": {
"column": "customer_value",
"bins": 10
}
}
},
"analyses": [
{
"id": "a4",
"type": "intersection",
"params": {
"source": {
"id": "a3",
"type": "buffer",
"params": {
"source": {
"id": "a2",
"type": "centroid",
"params": {
"source": {
"id": "b1",
"type": "kmeans",
"params": {
"source": {
"id": "b0",
"type": "source",
"params": {
"query": "SELECT * FROM populated_places_simple_reduced"
}
},
"clusters": 5
}
},
"category_column": "cluster_no"
}
},
"radius": 200000
}
},
"target": {
"id": "customer_home_locations",
"type": "source",
"params": {
"query": "SELECT * FROM populated_places_simple_reduced"
}
}
}
}
]
};
var testClient = new TestClient(mapConfig, 1234);
testClient.getLayergroup(function(err, layergroupResult) {
assert.ok(!err, err);
assert.ok(layergroupResult);
assert.ok(layergroupResult.metadata);
var analyses = layergroupResult.metadata.analyses;
assert.ok(analyses);
assert.equal(analyses.length, 1);
assert.equal(Object.keys(analyses[0].nodes).length, 5);
testClient.drain(done);
});
});
});

View File

@@ -633,3 +633,18 @@ GRANT SELECT ON TABLE analysis_rent_listings TO :PUBLICUSER;
--
GRANT SELECT, UPDATE, INSERT, DELETE ON cdb_analysis_catalog TO :TESTUSER;
create schema cdb_crankshaft;
GRANT USAGE ON SCHEMA cdb_crankshaft TO :TESTUSER;
CREATE TYPE kmeans_type as (cartodb_id numeric, cluster_no numeric);
CREATE OR REPLACE FUNCTION cdb_crankshaft.CDB_KMeans(query text, no_clusters integer,no_init integer default 20)
RETURNS setof kmeans_type as $$
DECLARE r kmeans_type;
BEGIN
FOR r IN EXECUTE format('select cartodb_id, ceil(random() * 10) AS cluster_no from (%s) _cdb_query', query) loop
RETURN NEXT r;
END LOOP;
RETURN;
END;
$$ LANGUAGE plpgsql;
GRANT ALL ON FUNCTION cdb_crankshaft.CDB_KMeans(text, integer, integer) TO :TESTUSER;

View File

@@ -33,6 +33,39 @@ module.exports.RESPONSE = {
}
};
module.exports.CARTOCSS = {
POINTS: [
'#layer{',
' marker-placement: point;',
' marker-allow-overlap: true;',
' marker-line-opacity: 0.2;',
' marker-line-width: 0.5;',
' marker-opacity: 1;',
' marker-width: 5;',
' marker-fill: red;',
'}'
].join('\n'),
LINES: [
'#lines {',
' line-color: black;',
' line-width: 1;',
' line-opacity: 1;',
'}'
].join('\n'),
POLYGONS: [
'#layer {',
' polygon-fill: red;',
' polygon-opacity: 0.6;',
' polygon-opacity: 0.7;',
' line-color: #FFF;',
' line-width: 0.5;',
' line-opacity: 1;',
'}'
].join('\n')
};
TestClient.prototype.getWidget = function(widgetName, params, callback) {
var self = this;