From 0728456c47fbb5dc9b0e719e0a3867e4f4a44cb0 Mon Sep 17 00:00:00 2001 From: mpuebla Date: Tue, 28 Apr 2020 17:29:09 -0300 Subject: [PATCH] Fix Para no mostrar listas duplicadas --- src/js/controller.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index bc37aad..8b67f05 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -46,10 +46,17 @@ angular.module('focaModalPrecioCondicion') //#region Metodos para la lista de precios $scope.openListaDePrecios = function () { - var datos = null; + var datos = []; focaModalPrecioCondicionService.getAllListaPrecio() .then(function (res) { - datos = res.data; + datos = res.data.reduce(function (acc, current) { + var x = acc.find(function (item) { return item.ID === current.ID }); + if (!x) { + return acc.concat([current]); + } else { + return acc; + } + }, []); focaModalService.modal({ titulo: 'Lista de precios', data: datos, -- 1.9.1