Skip to content

Commit

Permalink
Convert magns into floats
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmunoznovoa committed Oct 8, 2024
1 parent 6140cd0 commit 5285c2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cchloader/adapters/corbagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CorbaGenBaseAdapter(Schema):
@pre_load
def fix_numbers(self, data):
for attr, field in self.fields.items():
if isinstance(field, fields.Integer):
if isinstance(field, (fields.Integer, fields.Float)):
if not data.get(attr):
data[attr] = None
return data
Expand Down
6 changes: 3 additions & 3 deletions cchloader/models/corbagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class CorbaGenSchema(Schema):
name = fields.String(position=0, required=True)
local_timestamp = fields.DateTime(position=1, format='%Y-%m-%d %H:%M', required=True)
season = fields.Integer(position=2, validate=OneOf([0, 1]), required=True)
generacio = fields.Integer(position=3, required=True)
autocons = fields.Integer(position=4, required=True)
excedent = fields.Integer(position=5, required=True)
generacio = fields.Float(position=3, required=True)
autocons = fields.Float(position=4, required=True)
excedent = fields.Float(position=5, required=True)

CorbaGenSchema()

0 comments on commit 5285c2c

Please sign in to comment.