Skip to content

Commit

Permalink
Merge pull request #13974 from CartoDB/11511-georeference-only-numbers
Browse files Browse the repository at this point in the history
Allow only numeric values in latitude/longitude select in georeference analysis
  • Loading branch information
rubenmoya committed May 21, 2018
2 parents e8c52fa + e7e3b51 commit 1b540e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ ion for time-series (#12670)
* Hide legend title and header if not enabled (https://github.com/CartoDB/support/issues/1349)

### Bug fixes / enhancements
* Allow only numeric values in latitude/longitude select in georeference analysis (https://github.com/CartoDB/cartodb/pull/13974)
* Fix dataset name overflow in widgets (https://github.com/CartoDB/cartodb/pull/13972)
* Fix the public table view for non-migrated-users (#13969)
* Fix widgets not updating (https://github.com/CartoDB/cartodb/pull/13971)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module.exports = BaseAnalysisFormModel.extend({
latitude: {
type: 'Select',
title: _t('editor.layers.analysis-form.latitude'),
options: this._columnOptions.filterByType(['string', 'number']),
options: this._columnOptions.filterByType('number'),
dialogMode: 'float',
validators: this._getFieldValidator('latitude'),
placeholder: _t('editor.layers.analysis-form.georeference.select-latitude'),
Expand All @@ -137,7 +137,7 @@ module.exports = BaseAnalysisFormModel.extend({
longitude: {
type: 'Select',
title: _t('editor.layers.analysis-form.longitude'),
options: this._columnOptions.filterByType(['string', 'number']),
options: this._columnOptions.filterByType('number'),
dialogMode: 'float',
validators: this._getFieldValidator('longitude'),
placeholder: _t('editor.layers.analysis-form.georeference.select-longitude'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,16 @@ describe('editor/layers/layer-content-views/analyses/analysis-form-models/georef
expect(this.model.schema.postal_code_country.validators[0]).toBe('required');
});
});

fit('should return only numeric columns for latitude and longitude', function () {
this.model._columnOptions._columnOptions = {
cartodb_id: { type: 'number' },
title: { type: 'string' },
created_at: { type: 'date' }
};
this.model._setSchema();

expect(this.model.schema.latitude.options.length).toBe(1);
expect(this.model.schema.longitude.options.length).toBe(1);
});
});

0 comments on commit 1b540e9

Please sign in to comment.