Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renames parameter create_resources to create_all_resources #3842

Merged
merged 2 commits into from
Oct 4, 2023
Merged
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
19 changes: 9 additions & 10 deletions src/dispatch/case/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def case_new_create_flow(
conversation_target: str = None,
service_id: int = None,
db_session: Session,
create_resources: bool = True,
create_all_resources: bool = True,
):
"""Runs the case new creation flow."""
# we get the case
Expand All @@ -191,17 +191,16 @@ def case_new_create_flow(
case=case, db_session=db_session
)

# NOTE: we create all external resources for a Case unless it's
# created from a Signal, as it gets expensive when we have lots of them.
case_create_resources_flow(
db_session=db_session,
case_id=case.id,
individual_participants=individual_participants,
team_participants=team_participants,
conversation_target=conversation_target,
create_resources=create_resources,
create_all_resources=create_all_resources,
)
if not create_resources:
# we still want to update the ticket, but not twice if resources are created
ticket_flows.update_case_ticket(case=case, db_session=db_session)

if case.case_priority.page_assignee:
if not service_id:
Expand Down Expand Up @@ -613,15 +612,15 @@ def case_create_resources_flow(
individual_participants: List[str],
team_participants: List[str],
conversation_target: str = None,
create_resources: bool = True,
create_all_resources: bool = True,
) -> None:
"""Runs the case resource creation flow."""
case = get(db_session=db_session, case_id=case_id)

if case.assignee:
individual_participants.append((case.assignee.individual, None))

if create_resources:
if create_all_resources:
# we create the tactical group
direct_participant_emails = [i.email for i, _ in individual_participants]

Expand Down Expand Up @@ -664,9 +663,6 @@ def case_create_resources_flow(
document=case.case_document, project_id=case.project.id, db_session=db_session
)

# we update the ticket
ticket_flows.update_case_ticket(case=case, db_session=db_session)

try:
# we create the conversation and add participants to the thread
conversation_flows.create_case_conversation(case, conversation_target, db_session)
Expand Down Expand Up @@ -711,3 +707,6 @@ def case_create_resources_flow(
case_id=case.id,
)
log.exception(e)

# we update the ticket
ticket_flows.update_case_ticket(case=case, db_session=db_session)
2 changes: 1 addition & 1 deletion src/dispatch/signal/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def signal_instance_create_flow(
service_id=None,
conversation_target=conversation_target,
case_id=case.id,
create_resources=False,
create_all_resources=False,
)

if signal_instance.signal.engagements and entities:
Expand Down