fixing a stupid mistake.

This commit is contained in:
Dan Funk 2020-03-27 14:55:53 -04:00
parent 907e1cbbb3
commit 57f1fa670e
3 changed files with 16 additions and 4 deletions

View File

@ -97,6 +97,7 @@ def __get_workflow_api_model(processor: WorkflowProcessor, status_data=None):
last_task=Task.from_spiff(processor.bpmn_workflow.last_task),
next_task=None,
user_tasks=user_tasks,
workflow_spec_id=processor.workflow_spec_id,
spec_version=processor.get_spec_version(),
is_latest_spec=processor.get_spec_version() == processor.get_latest_version_string(processor.workflow_spec_id),
)

View File

@ -96,21 +96,21 @@ class TaskSchema(ma.Schema):
class WorkflowApi(object):
def __init__(self, id, status, user_tasks, last_task, next_task,
spec_version, is_latest_spec):
spec_version, is_latest_spec, workflow_spec_id):
self.id = id
self.status = status
self.user_tasks = user_tasks
self.last_task = last_task
self.next_task = next_task
self.workflow_spec_id = workflow_spec_id
self.spec_version = spec_version
self.is_latest_spec = is_latest_spec
class WorkflowApiSchema(ma.Schema):
class Meta:
model = WorkflowApi
fields = ["id", "status", "user_tasks", "last_task", "next_task",
"workflow_spec_id", "spec_version", "is_latest_spec", "is_active"]
"workflow_spec_id", "spec_version", "is_latest_spec"]
unknown = INCLUDE
status = EnumField(WorkflowStatus)
@ -121,6 +121,6 @@ class WorkflowApiSchema(ma.Schema):
@marshmallow.post_load
def make_workflow(self, data, **kwargs):
keys = ['id', 'status', 'user_tasks', 'last_task', 'next_task',
'workflow_spec_id', 'spec_version', 'is_latest_spec', "is_active"]
'workflow_spec_id', 'spec_version', 'is_latest_spec']
filtered_fields = {key: data[key] for key in keys}
return WorkflowApi(**filtered_fields)

View File

@ -34,6 +34,17 @@ class StudyModel(db.Model):
elif pbs.Q_COMPLETE:
self.protocol_builder_status = ProtocolBuilderStatus.IN_PROCESS
class Study():
def __init__(model: StudyModel, status, stats):
self.id = id
self.status = status
self.user_tasks = user_tasks
self.last_task = last_task
self.next_task = next_task
self.spec_version = spec_version
self.is_latest_spec = is_latest_spec
class StudyModelSchema(SQLAlchemyAutoSchema):
class Meta: