Quellcode durchsuchen

Fix creating ConsumptionType model

Maarten van den Berg vor 6 Jahren
Ursprung
Commit
dde60fe376
1 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  1. 3 3
      piket_client/model.py

+ 3 - 3
piket_client/model.py

@@ -133,7 +133,7 @@ class ConsumptionType(NamedTuple):
133 133
     consumption_type_id: int = None
134 134
     icon: str = None
135 135
 
136
-    def create(self) -> "Person":
136
+    def create(self) -> "ConsumptionType":
137 137
         """ Create a new ConsumptionType from the current attributes. As tuples
138 138
         are immutable, a new ConsumptionType with the correct id is returned.
139 139
         """
@@ -158,7 +158,7 @@ class ConsumptionType(NamedTuple):
158 158
             )
159 159
             return None
160 160
 
161
-        return Person.from_dict(data["consumption_type"])
161
+        return ConsumptionType.from_dict(data["consumption_type"])
162 162
 
163 163
     @classmethod
164 164
     def get(cls, consumption_type_id: int) -> "ConsumptionType":
@@ -215,7 +215,7 @@ class ConsumptionType(NamedTuple):
215 215
     @classmethod
216 216
     def from_dict(cls, data: dict) -> "ConsumptionType":
217 217
         """ Reconstruct a ConsumptionType from a dict. """
218
-        return ConsumptionType(
218
+        return cls(
219 219
             name=data["name"],
220 220
             consumption_type_id=data["consumption_type_id"],
221 221
             icon=data.get("icon"),