def get_dart_plate_state(cursor: pyodbc.Cursor, plate_barcode: str) -> str: """Gets the state of a DART plate. Arguments: cursor {pyodbc.Cursor} -- The cursor with which to execute queries. plate_barcode {str} -- The barcode of the plate whose state to fetch. Returns: str -- The state of the plate in DART. """ params = (plate_barcode, DART_STATE) cursor.execute(SQL_DART_GET_PLATE_PROPERTY, params) return str(cursor.fetchval())
def set_dart_plate_state_pending(cursor: pyodbc.Cursor, plate_barcode: str) -> bool: """Sets the state of a DART plate to pending. Arguments: cursor {pyodbc.Cursor} -- The cursor with which to execute queries. plate_barcode {str} -- The barcode of the plate whose state to set. Returns: bool -- Return True if DART was updated successfully, else False. """ params = (plate_barcode, DART_STATE, DART_STATE_PENDING) cursor.execute(SQL_DART_SET_PLATE_PROPERTY, params) # assuming that the stored procedure method returns an error code, convert it to an int to make sure response = int(cursor.fetchval()) return response == DART_SET_PROP_STATUS_SUCCESS