BeamlineConfig: Store spreadsheet
This commit is contained in:
@@ -14,7 +14,7 @@ from aaredaqlib.models import (
|
||||
def_loop_centering_zoom,
|
||||
SampleShortInfo,
|
||||
SessionStatus,
|
||||
BeamlineStateEnum, SessionsStateEnum,
|
||||
BeamlineStateEnum, SessionsStateEnum, SampleShortInfoList,
|
||||
)
|
||||
|
||||
from aaredaqlib.beamline import MXBeamline
|
||||
@@ -243,6 +243,24 @@ class BeamlineConfig:
|
||||
else:
|
||||
self.__client.delete(f"{self.__bl}:busy")
|
||||
|
||||
@property
|
||||
def spreadsheet(self) -> SampleShortInfoList:
|
||||
tmp = self.__client.get(f"{self.__bl}:spreadsheet")
|
||||
if tmp is None:
|
||||
return SampleShortInfoList(s=[])
|
||||
|
||||
data_dict = json.loads(tmp)
|
||||
return SampleShortInfoList(**data_dict)
|
||||
|
||||
def spreadsheet_pgroup(self, pgroup: str) -> SampleShortInfoList:
|
||||
sample = self.spreadsheet
|
||||
sample.s = list(filter(lambda x: x.user == pgroup, sample.s))
|
||||
return sample
|
||||
|
||||
@spreadsheet.setter
|
||||
def spreadsheet(self, data: SampleShortInfoList):
|
||||
self.__client.set(f"{self.__bl}:spreadsheet", data.model_dump_json())
|
||||
|
||||
@property
|
||||
def current_sample(self) -> SampleShortInfo | None:
|
||||
tmp = self.__client.get(f"{self.__bl}:current_sample")
|
||||
|
||||
Reference in New Issue
Block a user