remove org_id, fix error

This commit is contained in:
2023-06-02 09:27:51 +02:00
parent 09d264969d
commit 19dfee6e24

View File

@@ -59,18 +59,16 @@ class MachineBase(Document):
return data
def get_config(self, org_id: ObjectId, testname: LabtestsEnum):
test_id = Labtest.objects(org_id=org_id, test=testname).first()
def get_config(self, testname: LabtestsEnum):
test_id = Labtest.objects(org_id=self.org_id, test=testname).first()
if not test_id:
return []
test_id = test_id.id
machine_data = self.objects(tests__test=test_id).only('tests').first()
config_array = []
for test in machine_data.tests:
for test in self.tests:
if test.test.id == test_id:
config_array = test.config