make afterLayergroupCreate to follow the middleware signature
This commit is contained in:
@@ -180,7 +180,11 @@ MapController.prototype.create = function(req, res, prepareConfigFn, next) {
|
||||
},
|
||||
function afterLayergroupCreate(err, layergroup) {
|
||||
assert.ifError(err);
|
||||
self.afterLayergroupCreate(req, res, mapConfig, layergroup, context.analysesResults, this);
|
||||
res.locals.mapconfig = mapConfig;
|
||||
res.locals.analysesResults = context.analysesResults;
|
||||
res.locals.layergroup = layergroup;
|
||||
|
||||
self.afterLayergroupCreate(req, res, this);
|
||||
},
|
||||
function finish(err, layergroup) {
|
||||
if (err) {
|
||||
@@ -276,9 +280,12 @@ MapController.prototype.instantiateTemplate = function(req, res, prepareParamsFn
|
||||
},
|
||||
function afterLayergroupCreate(err, layergroup) {
|
||||
assert.ifError(err);
|
||||
self.afterLayergroupCreate(req, res, mapConfig, layergroup,
|
||||
mapConfigProvider.analysesResults,
|
||||
this);
|
||||
|
||||
res.locals.mapconfig = mapConfig;
|
||||
res.locals.analysesResults = mapConfigProvider.analysesResults;
|
||||
res.locals.layergroup = layergroup;
|
||||
|
||||
self.afterLayergroupCreate(req, res, this);
|
||||
},
|
||||
function finishTemplateInstantiation(err, layergroup) {
|
||||
if (err) {
|
||||
@@ -308,9 +315,9 @@ MapController.prototype.instantiateTemplate = function(req, res, prepareParamsFn
|
||||
);
|
||||
};
|
||||
|
||||
MapController.prototype.afterLayergroupCreate =
|
||||
function(req, res, mapconfig, layergroup, analysesResults, callback) {
|
||||
MapController.prototype.afterLayergroupCreate = function (req, res, callback) {
|
||||
var self = this;
|
||||
const { layergroup, mapconfig, user } = res.locals;
|
||||
|
||||
var tasksleft = 2; // redis key and affectedTables
|
||||
var errors = [];
|
||||
@@ -333,19 +340,14 @@ function(req, res, mapconfig, layergroup, analysesResults, callback) {
|
||||
// Don't wait for the mapview count increment to
|
||||
// take place before proceeding. Error will be logged
|
||||
// asynchronously
|
||||
var username = res.locals.user;
|
||||
this.metadataBackend.incMapviewCount(username, mapconfig.obj().stat_tag, function(err) {
|
||||
this.metadataBackend.incMapviewCount(user, mapconfig.obj().stat_tag, function(err) {
|
||||
req.profiler.done('incMapviewCount');
|
||||
if ( err ) {
|
||||
global.logger.log("ERROR: failed to increment mapview count for user '" + username + "': " + err);
|
||||
global.logger.log("ERROR: failed to increment mapview count for user '" + user + "': " + err);
|
||||
}
|
||||
done();
|
||||
});
|
||||
|
||||
res.locals.layergroup = layergroup;
|
||||
res.locals.mapconfig = mapconfig;
|
||||
res.locals.analysesResults = analysesResults;
|
||||
|
||||
step(
|
||||
function getAffectedTables () {
|
||||
self.getAffectedTables(req, res, this);
|
||||
|
||||
Reference in New Issue
Block a user