diff options
Diffstat (limited to 'ricky/param')
| -rw-r--r-- | ricky/param/enum.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ricky/param/enum.py b/ricky/param/enum.py index 137c58e..09a4cc3 100644 --- a/ricky/param/enum.py +++ b/ricky/param/enum.py @@ -41,11 +41,11 @@ class Enum(Param): return my_dict def from_normalized(self, value): - maximum = len(self._options - 1) + maximum = len(self._options) - 1 idx_val = int(round(maximum * value, 0)) self.value = self._options[idx_val] def as_normalized(self): - maximum = len(self._options - 1) - value = int(self.as_hex(), 16) + maximum = len(self._options) - 1 + value = self._options.index(self.value) return decimal.Decimal(value)/decimal.Decimal(maximum) |
