Explorar el Código

Only return active ConsumptionTypes in API

Maarten van den Berg %!s(int64=5) %!d(string=hace) años
padre
commit
5fb08466ad
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      piket_server/__init__.py

+ 1 - 1
piket_server/__init__.py

@@ -378,7 +378,7 @@ def reverse_consumption(consumption_id: int):
378 378
 @app.route("/consumption_types", methods=["GET"])
379 379
 def get_consumption_types():
380 380
     """ Return a list of currently active consumption types. """
381
-    ctypes = ConsumptionType.query.all()
381
+    ctypes = ConsumptionType.query.all().filter_by(active=True)
382 382
     result = [ct.as_dict for ct in ctypes]
383 383
     return jsonify(consumption_types=result)
384 384