Commit 0728456c47fbb5dc9b0e719e0a3867e4f4a44cb0
1 parent
7fe99e5f3f
Exists in
develop
Fix
Para no mostrar listas duplicadas
Showing
1 changed file
with
9 additions
and
2 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -46,10 +46,17 @@ angular.module('focaModalPrecioCondicion') |
46 | 46 | |
47 | 47 | //#region Metodos para la lista de precios |
48 | 48 | $scope.openListaDePrecios = function () { |
49 | - var datos = null; | |
49 | + var datos = []; | |
50 | 50 | focaModalPrecioCondicionService.getAllListaPrecio() |
51 | 51 | .then(function (res) { |
52 | - datos = res.data; | |
52 | + datos = res.data.reduce(function (acc, current) { | |
53 | + var x = acc.find(function (item) { return item.ID === current.ID }); | |
54 | + if (!x) { | |
55 | + return acc.concat([current]); | |
56 | + } else { | |
57 | + return acc; | |
58 | + } | |
59 | + }, []); | |
53 | 60 | focaModalService.modal({ |
54 | 61 | titulo: 'Lista de precios', |
55 | 62 | data: datos, |