Commit aad68e973a8c470cb05c3ece7dd29e61e2776d7f
1 parent
9abe1a4390
Exists in
develop
Fix
Lint errors
Showing
5 changed files
with
14 additions
and
18 deletions
Show diff stats
src/app/interfaces/IArticulo.ts
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
| ... | ... | @@ -133,10 +133,10 @@ export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDes |
| 133 | 133 | Object.keys(gruposArticulos).forEach(key => { |
| 134 | 134 | sinonimos.push({ productos: gruposArticulos[key], }); |
| 135 | 135 | }); |
| 136 | - for (let j = 0; j < articulo.productos.length; j++) { | |
| 136 | + for (const a of articulo.productos) { | |
| 137 | 137 | Object.keys(gruposArticulos).forEach((key, i) => { |
| 138 | - if (gruposArticulos[key][i].ID_SIN.toString() === articulo.productos[j].idSinonimo.toString()) { | |
| 139 | - sinonimos[i].cantidad = sinonimos[i].cantidadRestante = articulo.productos[j].cantidad; | |
| 138 | + if (gruposArticulos[key][i].ID_SIN.toString() === a.idSinonimo.toString()) { | |
| 139 | + sinonimos[i].cantidad = sinonimos[i].cantidadRestante = a.cantidad; | |
| 140 | 140 | } |
| 141 | 141 | }); |
| 142 | 142 | } |
src/app/services/articulo/articulo.service.ts
| ... | ... | @@ -57,16 +57,13 @@ export class ArticuloService { |
| 57 | 57 | for (const articuloCarrito of this.carrito) { |
| 58 | 58 | if (articuloCarrito.id === articulo.id) { |
| 59 | 59 | if (!articuloCarrito.productos) break; |
| 60 | - let samePromo = false | |
| 60 | + let samePromo = false; | |
| 61 | 61 | articuloCarrito.productos.forEach((a, i) => { |
| 62 | 62 | samePromo = (a.id === articulo.productos[i].id); |
| 63 | 63 | }); |
| 64 | - if (samePromo) { | |
| 65 | - this.addCant(articuloCarrito); | |
| 66 | - return; | |
| 67 | - } else { | |
| 68 | - break; | |
| 69 | - } | |
| 64 | + if (!samePromo) break; | |
| 65 | + this.addCant(articuloCarrito); | |
| 66 | + return; | |
| 70 | 67 | } |
| 71 | 68 | } |
| 72 | 69 | this.setArticulosSinImagen([articulo]); |
src/app/shared/header-publicidad/header-publicidad.component.ts
| ... | ... | @@ -108,10 +108,10 @@ export class HeaderPublicidadComponent implements OnInit { |
| 108 | 108 | Object.keys(gruposArticulos).forEach(key => { |
| 109 | 109 | sinonimos.push({ productos: gruposArticulos[key], }); |
| 110 | 110 | }); |
| 111 | - for (let j = 0; j < articulo.productos.length; j++) { | |
| 111 | + for (const a of articulo.productos) { | |
| 112 | 112 | Object.keys(gruposArticulos).forEach((key, i) => { |
| 113 | - if (gruposArticulos[key][i].ID_SIN.toString() === articulo.productos[j].idSinonimo.toString()) { | |
| 114 | - sinonimos[i].cantidad = sinonimos[i].cantidadRestante = articulo.productos[j].cantidad; | |
| 113 | + if (gruposArticulos[key][i].ID_SIN.toString() === a.idSinonimo.toString()) { | |
| 114 | + sinonimos[i].cantidad = sinonimos[i].cantidadRestante = a.cantidad; | |
| 115 | 115 | } |
| 116 | 116 | }); |
| 117 | 117 | } |
src/app/shared/promocion/promocion.component.ts
| ... | ... | @@ -54,14 +54,13 @@ export class PromocionComponent implements OnInit { |
| 54 | 54 | Object.keys(gruposArticulos).forEach(key => { |
| 55 | 55 | sinonimos.push({ productos: gruposArticulos[key], }); |
| 56 | 56 | }); |
| 57 | - for (let j = 0; j < promo.productos.length; j++) { | |
| 57 | + for (const promoProducto of promo.productos) { | |
| 58 | 58 | Object.keys(gruposArticulos).forEach((key, i) => { |
| 59 | - if (gruposArticulos[key][i].ID_SIN.toString() === promo.productos[j].idSinonimo.toString()) { | |
| 60 | - sinonimos[i].cantidad = sinonimos[i].cantidadRestante = promo.productos[j].cantidad; | |
| 59 | + if (gruposArticulos[key][i].ID_SIN.toString() === promoProducto.idSinonimo.toString()) { | |
| 60 | + sinonimos[i].cantidad = sinonimos[i].cantidadRestante = promoProducto.cantidad; | |
| 61 | 61 | } |
| 62 | 62 | }); |
| 63 | 63 | } |
| 64 | - res = sinonimos; | |
| 65 | 64 | this.openModalSinonimos(res, promo); |
| 66 | 65 | } else { |
| 67 | 66 | promo.cantidad = 1; |