Skip to content

Commit

Permalink
use limit and skip paging params for @Associations
Browse files Browse the repository at this point in the history
  • Loading branch information
harrymoore committed Aug 10, 2017
1 parent 69702bd commit 9fb2304
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
13 changes: 12 additions & 1 deletion duster/helpers/core/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ module.exports = function(app, dust)
var skip = context.resolve(params.skip);
var nodeSort = context.resolve(params.nodeSort);
var nodeSortDirection = context.resolve(params.nodeSortDirection);
var nodeSkip = context.resolve(params.nodeSkip);
var nodeLimit = context.resolve(params.nodeLimit);

// as
var as = context.resolve(params.as);
Expand All @@ -592,6 +594,14 @@ module.exports = function(app, dust)
{
skip = parseInt(skip);
}
if (isDefined(nodeLimit))
{
nodeLimit = parseInt(nodeLimit);
}
if (isDefined(nodeSkip))
{
nodeSkip = parseInt(nodeSkip);
}

// TRACKER: START
tracker.start(context);
Expand Down Expand Up @@ -732,7 +742,8 @@ module.exports = function(app, dust)
}

pagination = {
limit: otherNodeIds.length
limit: nodeLimit || limit || otherNodeIds.length,
skip: nodeSkip || skip || 0
};
if (nodeSort)
{
Expand Down
10 changes: 6 additions & 4 deletions middleware/form/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ exports = module.exports = function()
}, function(err, response, body) {

console.log("Response error: " + JSON.stringify(err));
console.log("Response: " + response);
console.log("Body: " + JSON.stringify(body));
console.log("Response: " + JSON.stringify(response,null,2));
console.log("Body: " + JSON.stringify(body,null,2));

if (err)
if (err || (response && response.body && response.body.error))
{
if (failureUrl)
{
Expand All @@ -157,10 +157,12 @@ exports = module.exports = function()
res.status(500);
res.json({
"ok": false,
"err": err,
"err": err || response.body.message,
"message": body
});
}

return;
}

if (successUrl)
Expand Down

0 comments on commit 9fb2304

Please sign in to comment.