diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 9937a0a8..b0bc435f 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -912,9 +912,9 @@ class VisualTest(TestMixin, Test): * :attr:`Severity.Info`: whether appearance range is B or A and functionality range is A. """ - appearance_range = Column(DBEnum(AppearanceRange), nullable=False) + appearance_range = Column(DBEnum(AppearanceRange), nullable=True) appearance_range.comment = AppearanceRange.__doc__ - functionality_range = Column(DBEnum(FunctionalityRange), nullable=False) + functionality_range = Column(DBEnum(FunctionalityRange), nullable=True) functionality_range.comment = FunctionalityRange.__doc__ labelling = Column(Boolean) labelling.comment = """Whether there are tags to be removed.""" diff --git a/ereuse_devicehub/resources/action/rate/v1_0.py b/ereuse_devicehub/resources/action/rate/v1_0.py index b29bcafa..9e821076 100644 --- a/ereuse_devicehub/resources/action/rate/v1_0.py +++ b/ereuse_devicehub/resources/action/rate/v1_0.py @@ -74,11 +74,6 @@ class RateAlgorithm(BaseRate): """ assert isinstance(device, Computer), 'Can only rate computers' - try: - visual_test = device.last_action_of(VisualTest) - except LookupError: - raise CannotRate('You need a visual test.') - rate = RateComputer() rate.processor = rate.data_storage = rate.ram = 1 # Init @@ -95,11 +90,9 @@ class RateAlgorithm(BaseRate): setattr(rate, field, result) rate_components = self.harmonic_mean_rates(rate.processor, rate.data_storage, rate.ram) - rate.appearance = self.Appearance[visual_test.appearance_range.name].value - rate.functionality = self.Functionality[visual_test.functionality_range.name].value - rate.rating = rate_components + rate.functionality + rate.appearance + rate.rating = rate_components device.actions_one.add(rate) - assert 0 <= rate.rating <= 4.7 + assert 0 <= rate.rating return rate diff --git a/ereuse_devicehub/resources/enums.py b/ereuse_devicehub/resources/enums.py index f5155eb9..9e74217c 100644 --- a/ereuse_devicehub/resources/enums.py +++ b/ereuse_devicehub/resources/enums.py @@ -34,10 +34,10 @@ class RatingRange(IntEnum): 3. Medium. 4. High. """ - VERY_LOW = 2 - LOW = 3 - MEDIUM = 4 - HIGH = 5 + VERY_LOW = 1 + LOW = 2 + MEDIUM = 3 + HIGH = 4 @classmethod def from_score(cls, val: Union[int, float]) -> 'RatingRange':