diff --git a/ereuse_devicehub/resources/event/models.py b/ereuse_devicehub/resources/event/models.py index 3bbc44d0..758c39ea 100644 --- a/ereuse_devicehub/resources/event/models.py +++ b/ereuse_devicehub/resources/event/models.py @@ -388,8 +388,17 @@ class IndividualRate(Rate): class ManualRate(IndividualRate): id = Column(UUID(as_uuid=True), ForeignKey(Rate.id), primary_key=True) labelling = Column(Boolean) + labelling.comment = """Sets if there are labels stuck that should + be removed. + """ 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.comment = """Grades the defects of a device + affecting usage. + """ class WorkbenchRate(ManualRate): @@ -400,7 +409,12 @@ class WorkbenchRate(ManualRate): check_range('data_storage', *RATE_POSITIVE)) graphic_card = Column(Float(decimal_return_scale=2), 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 diff --git a/ereuse_devicehub/resources/event/models.pyi b/ereuse_devicehub/resources/event/models.pyi index 8c68cf8e..b11d5e6e 100644 --- a/ereuse_devicehub/resources/event/models.pyi +++ b/ereuse_devicehub/resources/event/models.pyi @@ -203,6 +203,11 @@ class AggregateRate(Rate): class ManualRate(IndividualRate): + labelling = ... # type: Column + appearance_range = ... # type: Column + functionality_range = ... # type: Column + aggregate_rate_manual = ... #type: relationship + def __init__(self, **kwargs) -> None: super().__init__(**kwargs) self.labelling = ... # type: bool @@ -212,13 +217,22 @@ class ManualRate(IndividualRate): 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: super().__init__(**kwargs) self.processor = ... # type: float self.ram = ... # type: float self.data_storage = ... # 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 def ratings(self) -> Set[Rate]: diff --git a/ereuse_devicehub/resources/event/schemas.py b/ereuse_devicehub/resources/event/schemas.py index a4172bf7..4007b32d 100644 --- a/ereuse_devicehub/resources/event/schemas.py +++ b/ereuse_devicehub/resources/event/schemas.py @@ -142,13 +142,12 @@ class ManualRate(IndividualRate): appearance_range = EnumField(AppearanceRange, required=True, data_key='appearanceRange', - description='Grades the imperfections that aesthetically ' - 'affect the device, but not its usage.') + description=m.ManualRate.appearance_range.comment) functionality_range = EnumField(FunctionalityRange, required=True, data_key='functionalityRange', - description='Grades the defects of a device affecting usage.') - labelling = Boolean(description='Sets if there are labels stuck that should be removed.') + description=m.ManualRate.functionality_range.comment) + labelling = Boolean(description=m.ManualRate.labelling.comment) class WorkbenchRate(ManualRate): @@ -156,8 +155,10 @@ class WorkbenchRate(ManualRate): ram = Float() data_storage = Float() graphic_card = Float() - bios = EnumField(Bios, description='How difficult it has been to set the bios to ' - 'boot from the network.') + bios = Float() + bios_range = EnumField(Bios, + description=m.WorkbenchRate.bios_range.comment, + data_key='biosRange') class AggregateRate(Rate): diff --git a/tests/files/basic.snapshot.yaml b/tests/files/basic.snapshot.yaml index d13d1533..63e2f715 100644 --- a/tests/files/basic.snapshot.yaml +++ b/tests/files/basic.snapshot.yaml @@ -14,7 +14,7 @@ device: appearanceRange: A functionalityRange: B labelling: True - bios: B + biosRange: B components: - type: GraphicCard serialNumber: gc1s diff --git a/tests/test_lot.py b/tests/test_lot.py index 372330dc..8749ed96 100644 --- a/tests/test_lot.py +++ b/tests/test_lot.py @@ -254,7 +254,7 @@ def test_post_get_lot(user: UserClient): 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 GETting the results.""" parent, _ = user.post(({'name': 'Parent'}), res=Lot) diff --git a/tests/test_rate.py b/tests/test_rate.py index 699975cf..bf1cee90 100644 --- a/tests/test_rate.py +++ b/tests/test_rate.py @@ -17,7 +17,7 @@ from tests import conftest def test_workbench_rate_db(): rate = WorkbenchRate(processor=0.1, ram=1.0, - bios=Bios.A, + bios_range=Bios.A, labelling=False, graphic_card=0.1, data_storage=4.1,