From d64d4a7f25a7effe34711e894afaea1e06aab66b Mon Sep 17 00:00:00 2001 From: Jose Pinto Date: Thu, 14 Feb 2019 09:42:00 -0300 Subject: [PATCH] fix cotizacion cuando no hay valores --- src/js/controller.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 8ef68db..ca18896 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -43,10 +43,11 @@ angular.module('focaModalCotizacion') }); //CONVIERTO FECHAS A UTC-3 var fecha = new Date(precio[0].fecha); - var ultimaFecha = new Date($scope.cotizacion[0].FECHA); + var ultimaFecha = + ($scope.cotizacion[0]) ? new Date($scope.cotizacion[0].FECHA) : undefined; //SI LA ULTIMA COTIZACION YA FUE AGREGADA - if(fecha.getTime() === ultimaFecha.getTime()) { + if(ultimaFecha && fecha.getTime() === ultimaFecha.getTime()) { focaModalService .alert('Ya se encuentra la ultima cotización en la tabla'); $scope.obteniendoCotizacion = false; -- 1.9.1