fix pdf grid import with zones #19

This commit is contained in:
Lukas F. Hartmann 2018-05-07 19:56:26 +02:00
parent 4c5e6ea286
commit fc653e5ce5

View File

@ -488,8 +488,8 @@ router.post('/:id/artifacts-pdf', function(req, res, next) {
space_id: req.space._id, space_id: req.space._id,
user_id: userId, user_id: userId,
editor_name: req.guest_name, editor_name: req.guest_name,
w: artifact.board.w + 20, w: artifact.w + 20,
h: artifact.board.h + 40, h: artifact.h + 40,
x: x - 10, x: x - 10,
y: y - 30, y: y - 30,
z: number, z: number,
@ -498,10 +498,10 @@ router.post('/:id/artifacts-pdf', function(req, res, next) {
align: "center" align: "center"
}; };
db.Artifact.create(zone,((z) => { db.Artifact.create(zone).then((z) => {
redis.sendMessage("create", "Artifact", zone.toJSON(), req.channelId); redis.sendMessage("create", "Artifact", z.toJSON(), req.channelId);
cb(null, [artifact, zone]); cb(null, [artifact, zone]);
})); });
} else { } else {
cb(null, [artifact]); cb(null, [artifact]);
@ -522,10 +522,10 @@ router.post('/:id/artifacts-pdf', function(req, res, next) {
if (artifact_or_artifacts instanceof Array) { if (artifact_or_artifacts instanceof Array) {
_.each(artifact_or_artifacts, (a) => { _.each(artifact_or_artifacts, (a) => {
redis.sendMessage("create", "Artifact", a.toJSON(), req.channelId); redis.sendMessage("create", "Artifact", JSON.stringify(a), req.channelId);
}); });
} else  { } else  {
redis.sendMessage("create", "Artifact", artifact_or_artifacts.toJSON(), req.channelId); redis.sendMessage("create", "Artifact", JSON.stringify(artifact_or_artifacts), req.channelId);
} }
cb(null); cb(null);
}); });