Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions efile_app/efile/services/current_drafts.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ def create_current_draft(
jurisdiction: str,
*,
current_step: WorkflowStepKey | str = WorkflowStepKey.OPTIONS,
workflow_version: int = 1,
) -> FilingDraft:
draft = create_draft(
user=_authenticated_user(request),
jurisdiction=jurisdiction,
current_step=current_step,
workflow_version=workflow_version,
)
attach_current_draft(request, draft)
return draft
Expand All @@ -99,14 +101,19 @@ def ensure_current_draft(
jurisdiction: str,
*,
current_step: WorkflowStepKey | str | None = None,
workflow_version: int | None = None,
) -> FilingDraft:
draft = get_current_draft(request, jurisdiction=jurisdiction)
if draft is None:
return create_current_draft(
request,
jurisdiction,
current_step=current_step or WorkflowStepKey.OPTIONS,
workflow_version=workflow_version or 1,
)
if current_step is not None:
set_current_step(draft, current_step)
if workflow_version is not None and draft.workflow_version != workflow_version:
draft.workflow_version = workflow_version
draft.save(update_fields=["workflow_version", "updated_at"])
return draft
2 changes: 2 additions & 0 deletions efile_app/efile/services/drafts.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def create_draft(
user,
jurisdiction: str,
current_step: WorkflowStepKey | str = WorkflowStepKey.OPTIONS,
workflow_version: int = 1,
) -> FilingDraft:
"""Create a durable draft owned by an authenticated user."""

Expand All @@ -66,6 +67,7 @@ def create_draft(
user=user,
jurisdiction=jurisdiction,
current_step=str(current_step),
workflow_version=workflow_version,
)


Expand Down
Loading