From 325e55417beccd87352104ad800bc9542f4e5e78 Mon Sep 17 00:00:00 2001 From: Chroot Date: Tue, 26 May 2026 11:10:04 +0000 Subject: [PATCH 1/3] fix: resolver 9 issues MAJOR de SonarQube Cloud MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - views.py: eliminar parámetros no usados cart_items y product_ids - views.py: reemplazar f-strings sin placeholders por strings normales - base.html: añadir Comercialmeria - add_review.html: asociar label 'Puntuación' con rating-input via for - producto.html: promesa loadReviews con .catch() - gestionar_imagenes.html: mejorar alt text descriptivo - unban.html: quitar atributos deprecados width/cellspacing --- tienda/templates/tienda/add_review.html | 2 +- tienda/templates/tienda/base.html | 1 + tienda/templates/tienda/emails/unban.html | 2 +- tienda/templates/tienda/gestionar_imagenes.html | 2 +- tienda/templates/tienda/producto.html | 2 +- tienda/views.py | 8 ++++---- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tienda/templates/tienda/add_review.html b/tienda/templates/tienda/add_review.html index 8e09d4e..5d6d048 100644 --- a/tienda/templates/tienda/add_review.html +++ b/tienda/templates/tienda/add_review.html @@ -22,7 +22,7 @@ {% csrf_token %}
- +
{% for i in "12345" %} diff --git a/tienda/templates/tienda/base.html b/tienda/templates/tienda/base.html index 3fd8fe6..a1e7a3c 100644 --- a/tienda/templates/tienda/base.html +++ b/tienda/templates/tienda/base.html @@ -6,6 +6,7 @@ + Comercialmeria diff --git a/tienda/templates/tienda/emails/unban.html b/tienda/templates/tienda/emails/unban.html index 46171c7..c8779e3 100644 --- a/tienda/templates/tienda/emails/unban.html +++ b/tienda/templates/tienda/emails/unban.html @@ -1,4 +1,4 @@ - +
diff --git a/tienda/templates/tienda/gestionar_imagenes.html b/tienda/templates/tienda/gestionar_imagenes.html index b511c7d..93c1941 100644 --- a/tienda/templates/tienda/gestionar_imagenes.html +++ b/tienda/templates/tienda/gestionar_imagenes.html @@ -18,7 +18,7 @@
{% if producto.primary_image %} - {{ producto.primary_image.alt|default:producto.name }} + {{ producto.primary_image.alt|default:producto.name }} - imagen principal

Esta imagen no se puede cambiar desde aquí.

{% else %}

No hay imagen principal asignada.

diff --git a/tienda/templates/tienda/producto.html b/tienda/templates/tienda/producto.html index 412efac..d252f0a 100644 --- a/tienda/templates/tienda/producto.html +++ b/tienda/templates/tienda/producto.html @@ -157,6 +157,6 @@ async function loadReviews() { } } -loadReviews(); +loadReviews().catch(console.error); {% endblock %} diff --git a/tienda/views.py b/tienda/views.py index fc8c511..fdf5fa5 100644 --- a/tienda/views.py +++ b/tienda/views.py @@ -711,7 +711,7 @@ def _validate_order_items(cart_items, product_map, locked_reservation, reserved_ return None -def _create_order_and_items(request, order_total, cart_items, items_with_totals, product_map, product_ids, payment_method, payment_reference, shipping_address, locked_reservation): +def _create_order_and_items(request, order_total, items_with_totals, product_map, payment_method, payment_reference, shipping_address, locked_reservation): """Crea la orden y sus items, descuenta stock y marca reserva como completada.""" order = Order.objects.create( buyer=request.user if request.user.is_authenticated else None, @@ -778,7 +778,7 @@ def create_order_from_cart(request, payment_method, payment_reference="", shippi if error_msg: return None, error_msg - order = _create_order_and_items(request, order_total, cart_items, items_with_totals, product_map, product_ids, payment_method, payment_reference, shipping_address, locked_reservation) + order = _create_order_and_items(request, order_total, items_with_totals, product_map, payment_method, payment_reference, shipping_address, locked_reservation) _invalidate_product_cache(product_ids) cart.items.all().delete() @@ -1435,7 +1435,7 @@ def create_paypal_payment(request: HttpRequest): else: # Loguear el error logger.error("PAYPAL_CREATE_ERROR user_id=%s", request.user.id) - return JsonResponse({"error": f"Error al crear el pago"}, status=400) + return JsonResponse({"error": "Error al crear el pago"}, status=400) except ImportError: logger.error("PAYPAL_SDK_NOT_INSTALLED") @@ -1443,7 +1443,7 @@ def create_paypal_payment(request: HttpRequest): except Exception as e: error_msg = str(e) logger.exception("PAYPAL_CREATE_EXCEPTION user_id=%s", request.user.id) - return JsonResponse({"error": f"Error al crear el pago"}, status=500) + return JsonResponse({"error": "Error al crear el pago"}, status=500) @require_GET From 1ac17109a3004314eefbe4b71f1fbe62313fd76d Mon Sep 17 00:00:00 2001 From: Chroot Date: Tue, 26 May 2026 11:11:43 +0000 Subject: [PATCH 2/3] fix: usar async IIFE en loadReviews para S7785 --- tienda/templates/tienda/producto.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tienda/templates/tienda/producto.html b/tienda/templates/tienda/producto.html index d252f0a..dd9bc9b 100644 --- a/tienda/templates/tienda/producto.html +++ b/tienda/templates/tienda/producto.html @@ -157,6 +157,6 @@ async function loadReviews() { } } -loadReviews().catch(console.error); +(async () => { await loadReviews(); })(); {% endblock %} From 09f6f800deb4f093b7f1725c100ecf61f48a54ac Mon Sep 17 00:00:00 2001 From: Chroot Date: Tue, 26 May 2026 11:14:03 +0000 Subject: [PATCH 3/3] fix: script module con top-level await para S7785 --- tienda/templates/tienda/producto.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tienda/templates/tienda/producto.html b/tienda/templates/tienda/producto.html index dd9bc9b..caccbc1 100644 --- a/tienda/templates/tienda/producto.html +++ b/tienda/templates/tienda/producto.html @@ -94,7 +94,7 @@
- {% endblock %}