fixed linting issues w/ burnettk
This commit is contained in:
parent
deb16b80c3
commit
48893cae13
|
@ -27,12 +27,12 @@ class UserModel(SpiffworkflowBaseDBModel):
|
|||
|
||||
id: int = db.Column(db.Integer, primary_key=True)
|
||||
username: str = db.Column(db.String(255), nullable=False, unique=True)
|
||||
email: str = db.Column(db.String(255), index=True)
|
||||
email: str | None = db.Column(db.String(255), index=True)
|
||||
|
||||
service = db.Column(db.String(255), nullable=False, unique=False, index=True) # not 'openid' -- google, aws
|
||||
service_id = db.Column(db.String(255), nullable=False, unique=False, index=True)
|
||||
|
||||
display_name: str = db.Column(db.String(255))
|
||||
display_name: str | None = db.Column(db.String(255))
|
||||
tenant_specific_field_1: str | None = db.Column(db.String(255))
|
||||
tenant_specific_field_2: str | None = db.Column(db.String(255))
|
||||
tenant_specific_field_3: str | None = db.Column(db.String(255))
|
||||
|
|
|
@ -29,9 +29,11 @@ def get_onboarding() -> Response:
|
|||
task = processor.next_task()
|
||||
db.session.flush()
|
||||
if task:
|
||||
task_model: TaskModel | None = TaskModel.query.filter_by(guid=str(task.id),
|
||||
process_instance_id=process_instance.id).first()
|
||||
result['task_id'] = task_model.guid
|
||||
result['instructions'] = JinjaService.render_instructions_for_end_user(task_model)
|
||||
task_model: TaskModel | None = TaskModel.query.filter_by(
|
||||
guid=str(task.id), process_instance_id=process_instance.id
|
||||
).first()
|
||||
if task_model is not None:
|
||||
result["task_id"] = task_model.guid
|
||||
result["instructions"] = JinjaService.render_instructions_for_end_user(task_model)
|
||||
|
||||
return make_response(result, 200)
|
||||
|
|
|
@ -19,4 +19,4 @@ class TimesExecutedByUser(Script):
|
|||
if process_model_identifer is not None:
|
||||
return ProcessInstanceService.times_executed_by_user(process_model_identifer)
|
||||
else:
|
||||
return False
|
||||
return 0
|
||||
|
|
|
@ -57,18 +57,15 @@ class ProcessInstanceService:
|
|||
)
|
||||
return started_instance is not None
|
||||
|
||||
def times_executed_by_user(process_model_identifier: str) -> bool:
|
||||
@staticmethod
|
||||
def times_executed_by_user(process_model_identifier: str) -> int:
|
||||
total = (
|
||||
db.session.query(ProcessInstanceModel)
|
||||
.filter(
|
||||
ProcessInstanceModel.process_model_identifier == process_model_identifier
|
||||
)
|
||||
.filter(ProcessInstanceModel.process_model_identifier == process_model_identifier)
|
||||
.count()
|
||||
)
|
||||
return total
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def next_start_event_configuration(process_instance_model: ProcessInstanceModel) -> StartConfiguration:
|
||||
try:
|
||||
|
|
|
@ -45,4 +45,8 @@ class TestOnboarding(BaseTest):
|
|||
)
|
||||
|
||||
assert results.status_code == 200
|
||||
assert results.json == {"type": "default_view", "value": "my_tasks"}
|
||||
assert len(results.json.keys()) == 4
|
||||
assert results.json["type"] == "default_view"
|
||||
assert results.json["value"] == "my_tasks"
|
||||
assert results.json["instructions"] == ""
|
||||
assert results.json["task_id"] is not None
|
||||
|
|
|
@ -52,6 +52,7 @@ export default function HomePageRoutes() {
|
|||
<OnboardingView />
|
||||
{renderTabs()}
|
||||
<Routes>
|
||||
<Route path="/" element={<InProgressInstances />} />
|
||||
<Route path="my-tasks" element={<MyTasks />} />
|
||||
<Route path=":process_instance_id/:task_id" element={<TaskShow />} />
|
||||
<Route path="grouped" element={<InProgressInstances />} />
|
||||
|
|
|
@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|||
import MDEditor from '@uiw/react-md-editor';
|
||||
import HttpService from '../services/HttpService';
|
||||
import { Onboarding } from '../interfaces';
|
||||
import { objectIsEmpty } from '../helpers';
|
||||
|
||||
export default function OnboardingView() {
|
||||
const [onboarding, setOnboarding] = useState<Onboarding | null>(null);
|
||||
|
@ -16,7 +17,11 @@ export default function OnboardingView() {
|
|||
}, [setOnboarding]);
|
||||
|
||||
const onboardingElement = () => {
|
||||
if (onboarding && onboarding.instructions.length > 0) {
|
||||
if (
|
||||
onboarding &&
|
||||
!objectIsEmpty(onboarding) &&
|
||||
onboarding.instructions.length > 0
|
||||
) {
|
||||
return (
|
||||
<MDEditor.Markdown
|
||||
className="onboarding"
|
||||
|
|
Loading…
Reference in New Issue