Просмотр исходного кода

refactor: remove debugging print statement and use formatting macro for bandwidth display

Manuel 1 год назад
Родитель
Сommit
4367f9c34b
2 измененных файлов с 2 добавлено и 8 удалено
  1. 0 1
      services/fetch_data.py
  2. 2 7
      templates/partials/conexiones.html

+ 0 - 1
services/fetch_data.py

@@ -19,7 +19,6 @@ def fetch_squid_data():
             response = b""
             while chunk := s.recv(4096):
                 response += chunk
-        print(response.decode("utf-8"))  # Debugging line
         return response.decode("utf-8")
     except Exception as e:
         return str(e)

+ 2 - 7
templates/partials/conexiones.html

@@ -11,6 +11,7 @@
     {% endif %}
   {% else %}0 kbps{% endif %}
 {% endmacro %}
+
 {% set valid_users = {} %} {% for user, user_data in grouped_connections.items()
 %} {% if user and user != "-" and user != "Anónimo" %} {% set _ =
 valid_users.update({user: user_data}) %} {% endif %} {% endfor %}
@@ -245,13 +246,7 @@ valid_users.update({user: user_data}) %} {% endif %} {% endfor %}
             <div class="flex items-center text-sm text-gray-600" title="Total de velocidad del usuario">
               <i class="fas fa-tachometer-alt mr-1.5 text-teal-500"></i>
               <span>
-                {% if user_bw.value >= 1000000 %}
-                  {{ (user_bw.value / 1000000)|round(2) }} Gbps
-                {% elif user_bw.value >= 1000 %}
-                  {{ (user_bw.value / 1000)|round(2) }} Mbps
-                {% else %}
-                  {{ user_bw.value|round(2) }} Kbps
-                {% endif %}
+                {{ format_bandwidth(user_bw.value) }}
               </span>
             </div>