Bugfixes with rate
This commit is contained in:
parent
3cc510831c
commit
10c1a3f37d
|
@ -388,8 +388,17 @@ class IndividualRate(Rate):
|
||||||
class ManualRate(IndividualRate):
|
class ManualRate(IndividualRate):
|
||||||
id = Column(UUID(as_uuid=True), ForeignKey(Rate.id), primary_key=True)
|
id = Column(UUID(as_uuid=True), ForeignKey(Rate.id), primary_key=True)
|
||||||
labelling = Column(Boolean)
|
labelling = Column(Boolean)
|
||||||
|
labelling.comment = """Sets if there are labels stuck that should
|
||||||
|
be removed.
|
||||||
|
"""
|
||||||
appearance_range = Column(DBEnum(AppearanceRange))
|
appearance_range = Column(DBEnum(AppearanceRange))
|
||||||
|
appearance_range.comment = """Grades the imperfections that
|
||||||
|
aesthetically affect the device, but not its usage.
|
||||||
|
"""
|
||||||
functionality_range = Column(DBEnum(FunctionalityRange))
|
functionality_range = Column(DBEnum(FunctionalityRange))
|
||||||
|
functionality_range.comment = """Grades the defects of a device
|
||||||
|
affecting usage.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class WorkbenchRate(ManualRate):
|
class WorkbenchRate(ManualRate):
|
||||||
|
@ -400,7 +409,12 @@ class WorkbenchRate(ManualRate):
|
||||||
check_range('data_storage', *RATE_POSITIVE))
|
check_range('data_storage', *RATE_POSITIVE))
|
||||||
graphic_card = Column(Float(decimal_return_scale=2),
|
graphic_card = Column(Float(decimal_return_scale=2),
|
||||||
check_range('graphic_card', *RATE_POSITIVE))
|
check_range('graphic_card', *RATE_POSITIVE))
|
||||||
bios = Column(DBEnum(Bios))
|
bios = Column(Float(decimal_return_scale=2),
|
||||||
|
check_range('bios', *RATE_POSITIVE))
|
||||||
|
bios_range = Column(DBEnum(Bios))
|
||||||
|
bios_range.comment = """How difficult it has been to set the bios
|
||||||
|
to boot from the network.
|
||||||
|
"""
|
||||||
|
|
||||||
# todo ensure for WorkbenchRate version and software are not None when inserting them
|
# todo ensure for WorkbenchRate version and software are not None when inserting them
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,11 @@ class AggregateRate(Rate):
|
||||||
|
|
||||||
|
|
||||||
class ManualRate(IndividualRate):
|
class ManualRate(IndividualRate):
|
||||||
|
labelling = ... # type: Column
|
||||||
|
appearance_range = ... # type: Column
|
||||||
|
functionality_range = ... # type: Column
|
||||||
|
aggregate_rate_manual = ... #type: relationship
|
||||||
|
|
||||||
def __init__(self, **kwargs) -> None:
|
def __init__(self, **kwargs) -> None:
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.labelling = ... # type: bool
|
self.labelling = ... # type: bool
|
||||||
|
@ -212,13 +217,22 @@ class ManualRate(IndividualRate):
|
||||||
|
|
||||||
|
|
||||||
class WorkbenchRate(ManualRate):
|
class WorkbenchRate(ManualRate):
|
||||||
|
processor = ... # type: Column
|
||||||
|
ram = ... # type: Column
|
||||||
|
data_storage = ... # type: Column
|
||||||
|
graphic_card = ... # type: Column
|
||||||
|
bios_range = ... # type: Column
|
||||||
|
bios = ... # type: Column
|
||||||
|
aggregate_rate_workbench = ... #type: Column
|
||||||
|
|
||||||
def __init__(self, **kwargs) -> None:
|
def __init__(self, **kwargs) -> None:
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.processor = ... # type: float
|
self.processor = ... # type: float
|
||||||
self.ram = ... # type: float
|
self.ram = ... # type: float
|
||||||
self.data_storage = ... # type: float
|
self.data_storage = ... # type: float
|
||||||
self.graphic_card = ... # type: float
|
self.graphic_card = ... # type: float
|
||||||
self.bios = ... # type: Bios
|
self.bios_range = ... # type: Bios
|
||||||
|
self.bios = ... # type: float
|
||||||
self.aggregate_rate_workbench = ... #type: AggregateRate
|
self.aggregate_rate_workbench = ... #type: AggregateRate
|
||||||
|
|
||||||
def ratings(self) -> Set[Rate]:
|
def ratings(self) -> Set[Rate]:
|
||||||
|
|
|
@ -142,13 +142,12 @@ class ManualRate(IndividualRate):
|
||||||
appearance_range = EnumField(AppearanceRange,
|
appearance_range = EnumField(AppearanceRange,
|
||||||
required=True,
|
required=True,
|
||||||
data_key='appearanceRange',
|
data_key='appearanceRange',
|
||||||
description='Grades the imperfections that aesthetically '
|
description=m.ManualRate.appearance_range.comment)
|
||||||
'affect the device, but not its usage.')
|
|
||||||
functionality_range = EnumField(FunctionalityRange,
|
functionality_range = EnumField(FunctionalityRange,
|
||||||
required=True,
|
required=True,
|
||||||
data_key='functionalityRange',
|
data_key='functionalityRange',
|
||||||
description='Grades the defects of a device affecting usage.')
|
description=m.ManualRate.functionality_range.comment)
|
||||||
labelling = Boolean(description='Sets if there are labels stuck that should be removed.')
|
labelling = Boolean(description=m.ManualRate.labelling.comment)
|
||||||
|
|
||||||
|
|
||||||
class WorkbenchRate(ManualRate):
|
class WorkbenchRate(ManualRate):
|
||||||
|
@ -156,8 +155,10 @@ class WorkbenchRate(ManualRate):
|
||||||
ram = Float()
|
ram = Float()
|
||||||
data_storage = Float()
|
data_storage = Float()
|
||||||
graphic_card = Float()
|
graphic_card = Float()
|
||||||
bios = EnumField(Bios, description='How difficult it has been to set the bios to '
|
bios = Float()
|
||||||
'boot from the network.')
|
bios_range = EnumField(Bios,
|
||||||
|
description=m.WorkbenchRate.bios_range.comment,
|
||||||
|
data_key='biosRange')
|
||||||
|
|
||||||
|
|
||||||
class AggregateRate(Rate):
|
class AggregateRate(Rate):
|
||||||
|
|
|
@ -14,7 +14,7 @@ device:
|
||||||
appearanceRange: A
|
appearanceRange: A
|
||||||
functionalityRange: B
|
functionalityRange: B
|
||||||
labelling: True
|
labelling: True
|
||||||
bios: B
|
biosRange: B
|
||||||
components:
|
components:
|
||||||
- type: GraphicCard
|
- type: GraphicCard
|
||||||
serialNumber: gc1s
|
serialNumber: gc1s
|
||||||
|
|
|
@ -254,7 +254,7 @@ def test_post_get_lot(user: UserClient):
|
||||||
assert not l['children']
|
assert not l['children']
|
||||||
|
|
||||||
|
|
||||||
def test_post_add_children_view_ui_tree_normal(user: UserClient):
|
def test_lot_post_add_children_view_ui_tree_normal(user: UserClient):
|
||||||
"""Tests adding children lots to a lot through the view and
|
"""Tests adding children lots to a lot through the view and
|
||||||
GETting the results."""
|
GETting the results."""
|
||||||
parent, _ = user.post(({'name': 'Parent'}), res=Lot)
|
parent, _ = user.post(({'name': 'Parent'}), res=Lot)
|
||||||
|
|
|
@ -17,7 +17,7 @@ from tests import conftest
|
||||||
def test_workbench_rate_db():
|
def test_workbench_rate_db():
|
||||||
rate = WorkbenchRate(processor=0.1,
|
rate = WorkbenchRate(processor=0.1,
|
||||||
ram=1.0,
|
ram=1.0,
|
||||||
bios=Bios.A,
|
bios_range=Bios.A,
|
||||||
labelling=False,
|
labelling=False,
|
||||||
graphic_card=0.1,
|
graphic_card=0.1,
|
||||||
data_storage=4.1,
|
data_storage=4.1,
|
||||||
|
|
Reference in a new issue