fixing bug

This commit is contained in:
Cayo Puigdefabregas 2021-10-01 10:46:08 +02:00
parent eeb6db7bc2
commit 6599f4b66c
2 changed files with 12 additions and 2 deletions

View File

@ -12,7 +12,7 @@ from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = 'a0978ac6cf4a' revision = 'a0978ac6cf4a'
down_revision = '7ecb8ff7abad' down_revision = '3ac2bc1897ce'
branch_labels = None branch_labels = None
depends_on = None depends_on = None

View File

@ -424,14 +424,24 @@ class Ready(ActionWithMultipleDevices):
__doc__ = m.Ready.__doc__ __doc__ = m.Ready.__doc__
class ActionStatus(ActionWithMultipleDevices): class ActionStatus(Action):
rol_user = NestedOn(s_user.User, dump_only=True, exclude=('token',)) rol_user = NestedOn(s_user.User, dump_only=True, exclude=('token',))
devices = NestedOn(s_device.Device,
many=True,
required=False, # todo test ensuring len(devices) >= 1
only_query='id',
collection_class=OrderedSet)
documents = NestedOn(s_document.TradeDocument, documents = NestedOn(s_document.TradeDocument,
many=True, many=True,
required=False, # todo test ensuring len(devices) >= 1 required=False, # todo test ensuring len(devices) >= 1
only_query='id', only_query='id',
collection_class=OrderedSet) collection_class=OrderedSet)
@pre_load
def put_devices(self, data: dict):
if not 'devices' in data.keys():
data['devices'] = []
@post_load @post_load
def put_rol_user(self, data: dict): def put_rol_user(self, data: dict):
for dev in data['devices']: for dev in data['devices']: