opensubmit
opensubmit copied to clipboard
Refactor the state model
The state model for submissions is too deep weaved into the code. Some proposal for an explicit state machine implementation:
#states
SUBMITTED=1
COMPILETEST=2
WITHDRAWN=3
NotApplicable=object()
#inputs
NEW_SUBMISSION=1
JOB_REQUEST=2
WITHDRAW_REQUEST=3
def transition1():
if not bedingung:
return NotApplicable
datenbank_aendern()
return WITHDRAWN
transitions = {}
transitions[SUBMITTED, WITHDRAW_REQUEST] = [transition]
Is this still active?