delete visual test to compute rate (v1)
This commit is contained in:
parent
7bdc68ce8b
commit
83d9d12afb
|
@ -912,9 +912,9 @@ class VisualTest(TestMixin, Test):
|
||||||
* :attr:`Severity.Info`: whether appearance range is B or A and
|
* :attr:`Severity.Info`: whether appearance range is B or A and
|
||||||
functionality range is A.
|
functionality range is A.
|
||||||
"""
|
"""
|
||||||
appearance_range = Column(DBEnum(AppearanceRange), nullable=False)
|
appearance_range = Column(DBEnum(AppearanceRange), nullable=True)
|
||||||
appearance_range.comment = AppearanceRange.__doc__
|
appearance_range.comment = AppearanceRange.__doc__
|
||||||
functionality_range = Column(DBEnum(FunctionalityRange), nullable=False)
|
functionality_range = Column(DBEnum(FunctionalityRange), nullable=True)
|
||||||
functionality_range.comment = FunctionalityRange.__doc__
|
functionality_range.comment = FunctionalityRange.__doc__
|
||||||
labelling = Column(Boolean)
|
labelling = Column(Boolean)
|
||||||
labelling.comment = """Whether there are tags to be removed."""
|
labelling.comment = """Whether there are tags to be removed."""
|
||||||
|
|
|
@ -74,11 +74,6 @@ class RateAlgorithm(BaseRate):
|
||||||
"""
|
"""
|
||||||
assert isinstance(device, Computer), 'Can only rate computers'
|
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 = RateComputer()
|
||||||
rate.processor = rate.data_storage = rate.ram = 1 # Init
|
rate.processor = rate.data_storage = rate.ram = 1 # Init
|
||||||
|
|
||||||
|
@ -95,11 +90,9 @@ class RateAlgorithm(BaseRate):
|
||||||
setattr(rate, field, result)
|
setattr(rate, field, result)
|
||||||
|
|
||||||
rate_components = self.harmonic_mean_rates(rate.processor, rate.data_storage, rate.ram)
|
rate_components = self.harmonic_mean_rates(rate.processor, rate.data_storage, rate.ram)
|
||||||
rate.appearance = self.Appearance[visual_test.appearance_range.name].value
|
rate.rating = rate_components
|
||||||
rate.functionality = self.Functionality[visual_test.functionality_range.name].value
|
|
||||||
rate.rating = rate_components + rate.functionality + rate.appearance
|
|
||||||
device.actions_one.add(rate)
|
device.actions_one.add(rate)
|
||||||
assert 0 <= rate.rating <= 4.7
|
assert 0 <= rate.rating
|
||||||
return rate
|
return rate
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ class RatingRange(IntEnum):
|
||||||
3. Medium.
|
3. Medium.
|
||||||
4. High.
|
4. High.
|
||||||
"""
|
"""
|
||||||
VERY_LOW = 2
|
VERY_LOW = 1
|
||||||
LOW = 3
|
LOW = 2
|
||||||
MEDIUM = 4
|
MEDIUM = 3
|
||||||
HIGH = 5
|
HIGH = 4
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_score(cls, val: Union[int, float]) -> 'RatingRange':
|
def from_score(cls, val: Union[int, float]) -> 'RatingRange':
|
||||||
|
|
Reference in New Issue