Commit d64d4a7f25a7effe34711e894afaea1e06aab66b

Authored by Jose Pinto
1 parent 925f800ac0
Exists in master and in 1 other branch develop

fix cotizacion cuando no hay valores

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
src/js/controller.js
... ... @@ -43,10 +43,11 @@ angular.module('focaModalCotizacion')
43 43 });
44 44 //CONVIERTO FECHAS A UTC-3
45 45 var fecha = new Date(precio[0].fecha);
46   - var ultimaFecha = new Date($scope.cotizacion[0].FECHA);
  46 + var ultimaFecha =
  47 + ($scope.cotizacion[0]) ? new Date($scope.cotizacion[0].FECHA) : undefined;
47 48  
48 49 //SI LA ULTIMA COTIZACION YA FUE AGREGADA
49   - if(fecha.getTime() === ultimaFecha.getTime()) {
  50 + if(ultimaFecha && fecha.getTime() === ultimaFecha.getTime()) {
50 51 focaModalService
51 52 .alert('Ya se encuentra la ultima cotización en la tabla');
52 53 $scope.obteniendoCotizacion = false;