diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..75bb2042901930f807a588241612a29dd75e34d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.* +*.pyc +!.gitignore diff --git a/models/enercoop_operation.py b/models/enercoop_operation.py index 7dfbc80d04187885653b0b4b057cbca436046ae8..f34b3a703d8f48b578b4d00a5fb6ff25dc9a6394 100644 --- a/models/enercoop_operation.py +++ b/models/enercoop_operation.py @@ -169,7 +169,7 @@ class EnercoopOperation(models.Model): scale = 'day' return scale else: - delta = date_end - date_start + delta = (date_end - date_start).days if delta <= 7: scale = 'week' elif delta <= 31: @@ -410,7 +410,7 @@ class EnercoopOperation(models.Model): [('enercoop_operation_id', 'in', self.ids), ('date_slot', '>=', date_start), ('date_slot', '<', date_end)], - ['power', 'enercoop_operation_id', 'date_slot', 'year'], + ['power', 'enercoop_operation_id', 'date_slot'], ['comp_data_type', type_date], orderby='comp_data_type, date_slot ASC', lazy=False) # Get the date for the abscissa axis @@ -610,4 +610,4 @@ class EnercoopOperation(models.Model): 'scale': scale }) - return result_graph \ No newline at end of file + return result_graph