Return ranges in AggregateRate
This commit is contained in:
parent
5301242dbd
commit
47f5bf69ae
|
@ -456,6 +456,8 @@ class AggregateRate(Rate):
|
|||
kwargs.setdefault('version', StrictVersion('1.0'))
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# todo take value from LAST event (manual or workbench)
|
||||
|
||||
@property
|
||||
def processor(self):
|
||||
return self.workbench.processor
|
||||
|
@ -476,6 +478,22 @@ class AggregateRate(Rate):
|
|||
def bios(self):
|
||||
return self.workbench.bios
|
||||
|
||||
@property
|
||||
def functionality_range(self):
|
||||
return self.workbench.functionality_range
|
||||
|
||||
@property
|
||||
def appearance_range(self):
|
||||
return self.workbench.appearance_range
|
||||
|
||||
@property
|
||||
def bios_range(self):
|
||||
return self.workbench.bios_range
|
||||
|
||||
@property
|
||||
def labelling(self):
|
||||
return self.workbench.labelling
|
||||
|
||||
@classmethod
|
||||
def from_workbench_rate(cls, rate: WorkbenchRate):
|
||||
aggregate = cls()
|
||||
|
|
|
@ -199,6 +199,22 @@ class AggregateRate(Rate):
|
|||
def bios(self):
|
||||
return self.workbench.bios
|
||||
|
||||
@property
|
||||
def functionality_range(self):
|
||||
return self.workbench.functionality_range
|
||||
|
||||
@property
|
||||
def appearance_range(self):
|
||||
return self.workbench.appearance_range
|
||||
|
||||
@property
|
||||
def bios_range(self):
|
||||
return self.workbench.bios_range
|
||||
|
||||
@property
|
||||
def labelling(self):
|
||||
return self.workbench.labelling
|
||||
|
||||
@classmethod
|
||||
def from_workbench_rate(cls, rate: WorkbenchRate) -> AggregateRate:
|
||||
pass
|
||||
|
|
|
@ -99,7 +99,6 @@ class StepRandom(Step):
|
|||
class Rate(EventWithOneDevice):
|
||||
rating = Integer(validate=Range(*RATE_POSITIVE),
|
||||
dump_only=True,
|
||||
data_key='rating',
|
||||
description=m.Rate.rating.comment)
|
||||
software = EnumField(RatingSoftware,
|
||||
dump_only=True,
|
||||
|
@ -107,9 +106,7 @@ class Rate(EventWithOneDevice):
|
|||
version = Version(dump_only=True,
|
||||
description=m.Rate.version.comment)
|
||||
appearance = Integer(validate=Range(-3, 5), dump_only=True)
|
||||
functionality = Integer(validate=Range(-3, 5),
|
||||
dump_only=True,
|
||||
data_key='functionalityScore')
|
||||
functionality = Integer(validate=Range(-3, 5), dump_only=True)
|
||||
|
||||
|
||||
class IndividualRate(Rate):
|
||||
|
@ -150,6 +147,18 @@ class AggregateRate(Rate):
|
|||
data_storage = Float(dump_only=True)
|
||||
graphic_card = Float(dump_only=True)
|
||||
bios = EnumField(Bios, dump_only=True)
|
||||
bios_range = EnumField(Bios,
|
||||
description=m.WorkbenchRate.bios_range.comment,
|
||||
data_key='biosRange')
|
||||
appearance_range = EnumField(AppearanceRange,
|
||||
required=True,
|
||||
data_key='appearanceRange',
|
||||
description=m.ManualRate.appearance_range.comment)
|
||||
functionality_range = EnumField(FunctionalityRange,
|
||||
required=True,
|
||||
data_key='functionalityRange',
|
||||
description=m.ManualRate.functionality_range.comment)
|
||||
labelling = Boolean(description=m.ManualRate.labelling.comment)
|
||||
|
||||
|
||||
class Price(EventWithOneDevice):
|
||||
|
|
|
@ -62,6 +62,8 @@ def test_workbench_server_condensed(user: UserClient):
|
|||
assert not device['rate']['error']
|
||||
assert device['rate']['rating'] == 0
|
||||
assert device['rate']['workbench']
|
||||
assert device['rate']['appearanceRange'] == 'A'
|
||||
assert device['rate']['functionalityRange'] == 'B'
|
||||
assert device['tags'][0]['id'] == 'tag1'
|
||||
|
||||
|
||||
|
|
Reference in New Issue