Skip to content

Commit

Permalink
fix difference percent period calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
clavay authored and trombastic committed Dec 2, 2023
1 parent 8972f71 commit 79b98d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyscada/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,10 @@ def get_value(self, d1, d2):
elif type_str == "difference":
res = values[-1] - values[0]
elif type_str == "difference percent":
res = (values[-1] - values[0]) / min(values)
if values[0] == 0:
res = None
else:
res = (values[-1] - values[0]) / (values[0] * 100)
elif type_str == "delta":
res = 0
v = None
Expand Down

0 comments on commit 79b98d0

Please sign in to comment.