AAREDB: updated event functions. WIP: combine into one function!

This commit is contained in:
leonarski_f committed 2025-10-27 16:52:28 +01:00
1 parent e1f353f611
commit 79e736055d
1 file changed
+11 -10
+11 -10
View File
@@ -11,6 +11,7 @@ import requests
from aareDBclient import (
SetTellPosition,
SampleEventCreate,
SampleEventType,
SetTellPositionRequest,
CharacterizationParameters,
RotationParameters,
@@ -89,7 +90,7 @@ class AareWrapper:
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="Mounted"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("Mounted")),
)
except Exception as e:
print(e)
@@ -99,7 +100,7 @@ class AareWrapper:
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="Unmounted"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("Unmounted")),
)
except Exception as e:
print(e)
@@ -109,7 +110,7 @@ class AareWrapper:
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="Centered"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("Centered")),
)
except Exception as e:
print(e)
@@ -120,18 +121,18 @@ class AareWrapper:
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="Collected"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("Collected")),
)
except Exception as e:
print(e)
def sample_failed(self, s: Optional[SampleShortInfo]):
def sample_failed(self, s: Optional[SampleShortInfo], failed_comment: Optional[str] = None):
if s is None:
return
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="Failed"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("Failed"), comment=failed_comment),
)
except Exception as e:
print(e)
@@ -142,18 +143,18 @@ class AareWrapper:
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="AXCFailed"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("AXCFailed")),
)
except Exception as e:
print(e)
def alc_failed(self, s: Optional[SampleShortInfo]):
def alc_failed(self, s: Optional[SampleShortInfo], alc_comment: Optional[str] = None):
if s is None:
return
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="ALCFailed"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("ALCFailed"), comment=alc_comment),
)
except Exception as e:
print(e)
@@ -164,7 +165,7 @@ class AareWrapper:
try:
self.__sample_api.create_sample_event(
sample_id=s.db_id,
sample_event_create=SampleEventCreate(event_type="Lost"),
sample_event_create=SampleEventCreate(event_type=SampleEventType("Lost")),
)
except Exception as e:
print(e)