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