some support to interpolate form data w/ burnettk
This commit is contained in:
parent
1f7a35de50
commit
80696f5f23
|
@ -1,8 +1,8 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 86509963c525
|
||||
Revision ID: e7557de20067
|
||||
Revises:
|
||||
Create Date: 2022-06-30 11:55:54.677991
|
||||
Create Date: 2022-06-30 16:28:51.558359
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
|||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '86509963c525'
|
||||
revision = 'e7557de20067'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
@ -95,7 +95,7 @@ def upgrade():
|
|||
sa.Column('spiffworkflow_task_id', sa.String(length=50), nullable=False),
|
||||
sa.Column('process_instance_id', sa.Integer(), nullable=False),
|
||||
sa.Column('assigned_principal_id', sa.Integer(), nullable=True),
|
||||
sa.Column('process_instance_data', sa.Text(), nullable=True),
|
||||
sa.Column('spiffworkflow_task_data', sa.Text(), nullable=True),
|
||||
sa.Column('status', sa.String(length=20), nullable=False),
|
||||
sa.Column('form_file_name', sa.String(length=50), nullable=True),
|
||||
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True),
|
|
@ -35,7 +35,7 @@ class ActiveTaskModel(SpiffworkflowBaseDBModel):
|
|||
ForeignKey(ProcessInstanceModel.id), nullable=False # type: ignore
|
||||
)
|
||||
assigned_principal_id: int = db.Column(ForeignKey(PrincipalModel.id))
|
||||
process_instance_data: str = db.Column(db.Text)
|
||||
spiffworkflow_task_data: str = db.Column(db.Text)
|
||||
status: str = db.Column(db.String(20), nullable=False)
|
||||
form_file_name: str | None = db.Column(db.String(50))
|
||||
|
||||
|
|
|
@ -474,8 +474,18 @@ def task_show(task_id: int) -> flask.wrappers.Response:
|
|||
|
||||
file_contents = SpecFileService.get_data(
|
||||
process_model, active_task_assigned_to_me.form_file_name
|
||||
).decode("utf-8")
|
||||
|
||||
spiffworkflow_data_json = json.loads(
|
||||
active_task_assigned_to_me.spiffworkflow_task_data
|
||||
)
|
||||
active_task_assigned_to_me.form_json = file_contents.decode("utf-8")
|
||||
|
||||
# trade out pieces like "{{variable_name}}" for the corresponding form data value
|
||||
for key, value in spiffworkflow_data_json.items():
|
||||
if isinstance(value, str) or isinstance(value, int):
|
||||
file_contents = file_contents.replace("{{" + key + "}}", str(value))
|
||||
|
||||
active_task_assigned_to_me.form_json = file_contents
|
||||
|
||||
return make_response(jsonify(active_task_assigned_to_me), 200)
|
||||
|
||||
|
|
|
@ -354,7 +354,7 @@ class ProcessInstanceProcessor:
|
|||
process_instance_id=self.process_instance_model.id,
|
||||
# FIXME: look for the correct principal based on ready_or_waiting_task.lane
|
||||
assigned_principal_id=PrincipalModel.query.first().id,
|
||||
process_instance_data=json.dumps(self.get_data()),
|
||||
spiffworkflow_task_data=json.dumps(ready_or_waiting_task.data),
|
||||
status=ready_or_waiting_task.state.name,
|
||||
form_file_name=form_file_name,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue