From 3869742fd7a3bc08fae68eaca4cc273361879129 Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 4 Feb 2019 12:41:38 +0100 Subject: [PATCH] =?UTF-8?q?#1088=20ticket.descriptor=20a=C3=B1adir=20poliz?= =?UTF-8?q?on=20interval=20server=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ticket/back/methods/ticket/getPossibleStowaways.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ticket/back/methods/ticket/getPossibleStowaways.js b/modules/ticket/back/methods/ticket/getPossibleStowaways.js index 4ff5fa9d5..581a0a9c3 100644 --- a/modules/ticket/back/methods/ticket/getPossibleStowaways.js +++ b/modules/ticket/back/methods/ticket/getPossibleStowaways.js @@ -20,6 +20,10 @@ module.exports = Self => { Self.getPossibleStowaways = async ticketFk => { let ship = await Self.app.models.Ticket.findById(ticketFk); + + if (!ship || !ship.shipped) + return []; + let lowestDate = new Date(ship.shipped.getTime()); lowestDate.setHours(0, 0, -1, 0);