From eeafad7cd97d4f1bc6b79ba87656c4c6a79fa461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Mart=C3=ADn?= Date: Mon, 30 Jul 2018 15:52:41 +0200 Subject: [PATCH] remove step --- lib/cartodb/backends/filter-stats.js | 60 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/lib/cartodb/backends/filter-stats.js b/lib/cartodb/backends/filter-stats.js index 08861b21..7aa3adc7 100644 --- a/lib/cartodb/backends/filter-stats.js +++ b/lib/cartodb/backends/filter-stats.js @@ -1,5 +1,4 @@ var _ = require('underscore'); -var step = require('step'); var AnalysisFilter = require('../models/filter/analysis'); function FilterStatsBackends(pgQueryRunner) { @@ -26,34 +25,33 @@ function getEstimatedRows(pgQueryRunner, username, query, callback) { FilterStatsBackends.prototype.getFilterStats = function (username, unfiltered_query, filters, callback) { var stats = {}; var self = this; - step( - function getUnfilteredRows() { - getEstimatedRows(self.pgQueryRunner, username, unfiltered_query, this); - }, - function receiveUnfilteredRows(err, rows) { - if (err){ - callback(err); - return; - } - stats.unfiltered_rows = rows; - this(null, rows); - }, - function getFilteredRows() { - if ( filters && !_.isEmpty(filters)) { - var analysisFilter = new AnalysisFilter(filters); - var query = analysisFilter.sql(unfiltered_query); - getEstimatedRows(self.pgQueryRunner, username, query, this); - } else { - this(null, null); - } - }, - function receiveFilteredRows(err, rows) { - if (err){ - callback(err); - return; - } - stats.filtered_rows = rows; - callback(null, stats); - } - ); + + function getUnfilteredRows() { + getEstimatedRows(self.pgQueryRunner, username, unfiltered_query, this); + }, + function receiveUnfilteredRows(err, rows) { + if (err){ + callback(err); + return; + } + stats.unfiltered_rows = rows; + this(null, rows); + }, + function getFilteredRows() { + if ( filters && !_.isEmpty(filters)) { + var analysisFilter = new AnalysisFilter(filters); + var query = analysisFilter.sql(unfiltered_query); + getEstimatedRows(self.pgQueryRunner, username, query, this); + } else { + this(null, null); + } + }, + function receiveFilteredRows(err, rows) { + if (err){ + callback(err); + return; + } + stats.filtered_rows = rows; + callback(null, stats); + } };