From 8fbdabb34c086105753518d836d87f29e60509f4 Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Wed, 23 Dec 2020 12:09:18 +0100 Subject: [PATCH] Improve variable names (replace i by speaking names) --- aleksis/core/static/js/edit_dashboard.js | 4 ++-- aleksis/core/views.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aleksis/core/static/js/edit_dashboard.js b/aleksis/core/static/js/edit_dashboard.js index 18ddaf457..0cc90de60 100644 --- a/aleksis/core/static/js/edit_dashboard.js +++ b/aleksis/core/static/js/edit_dashboard.js @@ -1,7 +1,7 @@ function refreshOrder() { $(".order-input").val(0); - $("#widgets > .col").each(function (i) { - const order = (i + 1) * 10; + $("#widgets > .col").each(function (index) { + const order = (index + 1) * 10; let pk = $(this).attr("data-pk"); let sel = $("#order-form input[value=" + pk + "].pk-input").next(); sel.val(order); diff --git a/aleksis/core/views.py b/aleksis/core/views.py index dc3ce194d..a8e26db51 100644 --- a/aleksis/core/views.py +++ b/aleksis/core/views.py @@ -790,11 +790,11 @@ class EditDashboardView(View): context["widgets"] = widgets context["not_used_widgets"] = not_used_widgets - i = 10 + order = 10 initial = [] for widget in widgets: - initial.append({"pk": widget, "order": i}) - i += 10 + initial.append({"pk": widget, "order": order}) + order += 10 for widget in not_used_widgets: initial.append({"pk": widget, "order": 0}) -- GitLab