Skip to content

Commit

Permalink
Merge branch 'master' into 'master'
Browse files Browse the repository at this point in the history
Master

See merge request !24
  • Loading branch information
kvsrohit committed Aug 22, 2018
2 parents a6f4cf5 + df03288 commit 42d908a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/mixins/maker-checker-mixin-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,9 @@ function addOERemoteMethods(Model) {
var modelName = Model.definition.name;
var ChangeWorkflowRequest = app.models.ChangeWorkflowRequest;

var inputPV = data.pv;
delete data.pv;

var idName = Model.definition.idName();
var id = data[idName] || 'this_id_wont_exist';
ChangeWorkflowRequest.find({
Expand Down Expand Up @@ -856,7 +859,7 @@ function addOERemoteMethods(Model) {
var mapping = res[0];

let workflowBody = mapping.workflowBody;
workflowBody.processVariables = workflowBody.processVariables || {};
workflowBody.processVariables = Object.assign(workflowBody.processVariables || {}, inputPV);
workflowBody.processVariables._operation = mData.operation;
workflowBody.processVariables._modifiers = mData._modifiers;
workflowBody.processVariables._modelInstance = mData.data;
Expand Down
8 changes: 8 additions & 0 deletions common/models/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ module.exports = function Task(Task) {
Task.prototype.complete = function complete(data, options, next) {
var self = this;
var tname = self.name;

if (self.status !== 'pending') {
let error = new Error('Task already completed');
error.code = 'TASK_ALREADY_COMPLETED';
error.status = error.statusCode = 409;
return next(error);
}

self.processInstance({}, options, function fetchProcessDef(err, process) {
if (err) {
log.error(options, err);
Expand Down

0 comments on commit 42d908a

Please sign in to comment.