added completed column to active task w/ burnettk
This commit is contained in:
parent
07d448a270
commit
66c5272766
|
@ -1,3 +1,5 @@
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from logging.config import fileConfig
|
from logging.config import fileConfig
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
"""empty message
|
"""empty message
|
||||||
|
|
||||||
Revision ID: 4d75421c0af0
|
Revision ID: 90dcaa99faa7
|
||||||
Revises:
|
Revises:
|
||||||
Create Date: 2022-12-06 17:42:56.417673
|
Create Date: 2022-12-16 16:40:22.246123
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '4d75421c0af0'
|
revision = '90dcaa99faa7'
|
||||||
down_revision = None
|
down_revision = None
|
||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
|
@ -189,12 +189,14 @@ def upgrade():
|
||||||
sa.Column('task_type', sa.String(length=50), nullable=True),
|
sa.Column('task_type', sa.String(length=50), nullable=True),
|
||||||
sa.Column('task_status', sa.String(length=50), nullable=True),
|
sa.Column('task_status', sa.String(length=50), nullable=True),
|
||||||
sa.Column('process_model_display_name', sa.String(length=255), nullable=True),
|
sa.Column('process_model_display_name', sa.String(length=255), nullable=True),
|
||||||
|
sa.Column('completed', sa.Boolean(), nullable=False),
|
||||||
sa.ForeignKeyConstraint(['actual_owner_id'], ['user.id'], ),
|
sa.ForeignKeyConstraint(['actual_owner_id'], ['user.id'], ),
|
||||||
sa.ForeignKeyConstraint(['lane_assignment_id'], ['group.id'], ),
|
sa.ForeignKeyConstraint(['lane_assignment_id'], ['group.id'], ),
|
||||||
sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ),
|
sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id'),
|
sa.PrimaryKeyConstraint('id'),
|
||||||
sa.UniqueConstraint('task_id', 'process_instance_id', name='active_task_unique')
|
sa.UniqueConstraint('task_id', 'process_instance_id', name='active_task_unique')
|
||||||
)
|
)
|
||||||
|
op.create_index(op.f('ix_active_task_completed'), 'active_task', ['completed'], unique=False)
|
||||||
op.create_table('message_correlation',
|
op.create_table('message_correlation',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('process_instance_id', sa.Integer(), nullable=False),
|
sa.Column('process_instance_id', sa.Integer(), nullable=False),
|
||||||
|
@ -304,6 +306,7 @@ def downgrade():
|
||||||
op.drop_index(op.f('ix_message_correlation_name'), table_name='message_correlation')
|
op.drop_index(op.f('ix_message_correlation_name'), table_name='message_correlation')
|
||||||
op.drop_index(op.f('ix_message_correlation_message_correlation_property_id'), table_name='message_correlation')
|
op.drop_index(op.f('ix_message_correlation_message_correlation_property_id'), table_name='message_correlation')
|
||||||
op.drop_table('message_correlation')
|
op.drop_table('message_correlation')
|
||||||
|
op.drop_index(op.f('ix_active_task_completed'), table_name='active_task')
|
||||||
op.drop_table('active_task')
|
op.drop_table('active_task')
|
||||||
op.drop_table('user_group_assignment')
|
op.drop_table('user_group_assignment')
|
||||||
op.drop_table('secret')
|
op.drop_table('secret')
|
|
@ -52,6 +52,7 @@ class ActiveTaskModel(SpiffworkflowBaseDBModel):
|
||||||
task_type: str = db.Column(db.String(50))
|
task_type: str = db.Column(db.String(50))
|
||||||
task_status: str = db.Column(db.String(50))
|
task_status: str = db.Column(db.String(50))
|
||||||
process_model_display_name: str = db.Column(db.String(255))
|
process_model_display_name: str = db.Column(db.String(255))
|
||||||
|
completed: bool = db.Column(db.Boolean, default=False, nullable=False, index=True)
|
||||||
|
|
||||||
active_task_users = relationship("ActiveTaskUserModel", cascade="delete")
|
active_task_users = relationship("ActiveTaskUserModel", cascade="delete")
|
||||||
potential_owners = relationship( # type: ignore
|
potential_owners = relationship( # type: ignore
|
||||||
|
|
|
@ -940,7 +940,12 @@ def process_instance_list(
|
||||||
|
|
||||||
print(f"report_filter.with_relation_to_me: {report_filter.with_relation_to_me}")
|
print(f"report_filter.with_relation_to_me: {report_filter.with_relation_to_me}")
|
||||||
if report_filter.with_relation_to_me is True:
|
if report_filter.with_relation_to_me is True:
|
||||||
process_instance_query = process_instance_query.outerjoin(ActiveTaskModel).outerjoin(ActiveTaskUserModel, ActiveTaskUserModel.user_id == g.user.id)
|
process_instance_query = process_instance_query.outerjoin(ActiveTaskModel).outerjoin(ActiveTaskUserModel,
|
||||||
|
and_(
|
||||||
|
ActiveTaskModel.id == ActiveTaskUserModel.active_task_id,
|
||||||
|
ActiveTaskUserModel.user_id == g.user.id,
|
||||||
|
),
|
||||||
|
)
|
||||||
process_instance_query = process_instance_query.filter(or_(ActiveTaskUserModel.id.is_not(None), ProcessInstanceModel.process_initiator_id == g.user.id))
|
process_instance_query = process_instance_query.filter(or_(ActiveTaskUserModel.id.is_not(None), ProcessInstanceModel.process_initiator_id == g.user.id))
|
||||||
|
|
||||||
if report_filter.initiated_by_me is True:
|
if report_filter.initiated_by_me is True:
|
||||||
|
@ -1417,6 +1422,7 @@ def get_tasks(
|
||||||
.outerjoin(GroupModel, GroupModel.id == ActiveTaskModel.lane_assignment_id)
|
.outerjoin(GroupModel, GroupModel.id == ActiveTaskModel.lane_assignment_id)
|
||||||
.join(ProcessInstanceModel)
|
.join(ProcessInstanceModel)
|
||||||
.join(UserModel, UserModel.id == ProcessInstanceModel.process_initiator_id)
|
.join(UserModel, UserModel.id == ProcessInstanceModel.process_initiator_id)
|
||||||
|
.filter(ActiveTaskModel.completed == False)
|
||||||
)
|
)
|
||||||
|
|
||||||
if processes_started_by_user:
|
if processes_started_by_user:
|
||||||
|
@ -1451,7 +1457,8 @@ def get_tasks(
|
||||||
else:
|
else:
|
||||||
active_tasks_query = active_tasks_query.filter(ActiveTaskModel.lane_assignment_id.is_(None)) # type: ignore
|
active_tasks_query = active_tasks_query.filter(ActiveTaskModel.lane_assignment_id.is_(None)) # type: ignore
|
||||||
|
|
||||||
active_tasks = active_tasks_query.add_columns(
|
active_tasks = (
|
||||||
|
active_tasks_query.add_columns(
|
||||||
ProcessInstanceModel.process_model_identifier,
|
ProcessInstanceModel.process_model_identifier,
|
||||||
ProcessInstanceModel.status.label("process_instance_status"), # type: ignore
|
ProcessInstanceModel.status.label("process_instance_status"), # type: ignore
|
||||||
ProcessInstanceModel.updated_at_in_seconds,
|
ProcessInstanceModel.updated_at_in_seconds,
|
||||||
|
@ -1463,7 +1470,10 @@ def get_tasks(
|
||||||
ActiveTaskModel.process_model_display_name,
|
ActiveTaskModel.process_model_display_name,
|
||||||
ActiveTaskModel.process_instance_id,
|
ActiveTaskModel.process_instance_id,
|
||||||
ActiveTaskUserModel.user_id.label("current_user_is_potential_owner"),
|
ActiveTaskUserModel.user_id.label("current_user_is_potential_owner"),
|
||||||
).paginate(page=page, per_page=per_page, error_out=False)
|
)
|
||||||
|
.order_by(desc(ActiveTaskModel.id)) # type: ignore
|
||||||
|
.paginate(page=page, per_page=per_page, error_out=False)
|
||||||
|
)
|
||||||
|
|
||||||
response_json = {
|
response_json = {
|
||||||
"results": active_tasks.items,
|
"results": active_tasks.items,
|
||||||
|
@ -1683,7 +1693,7 @@ def task_submit(
|
||||||
spiff_task.terminate_loop()
|
spiff_task.terminate_loop()
|
||||||
|
|
||||||
active_task = ActiveTaskModel.query.filter_by(
|
active_task = ActiveTaskModel.query.filter_by(
|
||||||
process_instance_id=process_instance_id, task_id=task_id
|
process_instance_id=process_instance_id, task_id=task_id, completed=False
|
||||||
).first()
|
).first()
|
||||||
if active_task is None:
|
if active_task is None:
|
||||||
raise (
|
raise (
|
||||||
|
@ -1713,7 +1723,7 @@ def task_submit(
|
||||||
# next_task = processor.next_task()
|
# next_task = processor.next_task()
|
||||||
|
|
||||||
next_active_task_assigned_to_me = (
|
next_active_task_assigned_to_me = (
|
||||||
ActiveTaskModel.query.filter_by(process_instance_id=process_instance_id)
|
ActiveTaskModel.query.filter_by(process_instance_id=process_instance_id, completed=False)
|
||||||
.order_by(asc(ActiveTaskModel.id)) # type: ignore
|
.order_by(asc(ActiveTaskModel.id)) # type: ignore
|
||||||
.join(ActiveTaskUserModel)
|
.join(ActiveTaskUserModel)
|
||||||
.filter_by(user_id=principal.user_id)
|
.filter_by(user_id=principal.user_id)
|
||||||
|
|
|
@ -699,10 +699,11 @@ class ProcessInstanceProcessor:
|
||||||
db.session.add(active_task_user)
|
db.session.add(active_task_user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
# if len(active_tasks) > 0:
|
if len(active_tasks) > 0:
|
||||||
# for at in active_tasks:
|
for at in active_tasks:
|
||||||
# db.session.delete(at)
|
at.completed = True
|
||||||
# db.session.commit()
|
db.session.add(at)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_parser() -> MyCustomParser:
|
def get_parser() -> MyCustomParser:
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default function ProcessInstanceList() {
|
||||||
<>
|
<>
|
||||||
{processInstanceBreadcrumbElement()}
|
{processInstanceBreadcrumbElement()}
|
||||||
{processInstanceTitleElement()}
|
{processInstanceTitleElement()}
|
||||||
<ProcessInstanceListTable />
|
<ProcessInstanceListTable additionalParams="with_relation_to_me=true" />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,6 @@ export default function TaskShow() {
|
||||||
} else if (taskToUse.form_ui_schema) {
|
} else if (taskToUse.form_ui_schema) {
|
||||||
formUiSchema = JSON.parse(taskToUse.form_ui_schema);
|
formUiSchema = JSON.parse(taskToUse.form_ui_schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskToUse.state !== 'READY') {
|
if (taskToUse.state !== 'READY') {
|
||||||
formUiSchema = Object.assign(formUiSchema || {}, {
|
formUiSchema = Object.assign(formUiSchema || {}, {
|
||||||
'ui:readonly': true,
|
'ui:readonly': true,
|
||||||
|
@ -184,7 +183,7 @@ export default function TaskShow() {
|
||||||
reactFragmentToHideSubmitButton = <div />;
|
reactFragmentToHideSubmitButton = <div />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskToUse.type === 'Manual Task') {
|
if (taskToUse.type === 'Manual Task' && taskToUse.state === 'READY') {
|
||||||
reactFragmentToHideSubmitButton = (
|
reactFragmentToHideSubmitButton = (
|
||||||
<div>
|
<div>
|
||||||
<Button type="submit">Continue</Button>
|
<Button type="submit">Continue</Button>
|
||||||
|
|
Loading…
Reference in New Issue