delete visual test to compute rate (v1)

This commit is contained in:
jordi.nadeu 2019-10-22 15:53:44 +02:00
parent 7bdc68ce8b
commit 83d9d12afb
3 changed files with 8 additions and 15 deletions

View file

@ -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."""

View file

@ -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

View file

@ -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':