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

Fix order messages #4147

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions cg/services/orders/submitter/ticket_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ def add_sample_case_name_to_message(message: str, case_name: str | None) -> str:
def add_existing_sample_info_to_message(
self, message: str, customer_id: str, internal_id: str, case_name: str
) -> str:

existing_sample: Sample = self.status_db.get_sample_by_internal_id(internal_id=internal_id)

sample_customer = ""
if existing_sample.customer_id != customer_id:
sample_customer = " from " + existing_sample.customer.internal_id

message += f"{existing_sample.name}, application: {existing_sample.application_version.application.tag}, case: {case_name} (already existing sample{sample_customer}), priority: {existing_sample.priority}"
return message

Expand Down Expand Up @@ -180,6 +178,7 @@ def create_case_xml_sample_list(self, order, message: str) -> str:
if not case.is_new:
db_case = self.status_db.get_case_by_internal_id(case.internal_id)
for sample in db_case.samples:
message += self.NEW_LINE
message = self.add_existing_sample_info_to_message(
message=message,
customer_id=sample.customer.internal_id,
Expand All @@ -189,6 +188,7 @@ def create_case_xml_sample_list(self, order, message: str) -> str:
else:
for sample in case.samples:
if not sample.is_new:
message += self.NEW_LINE
message = self.add_existing_sample_info_to_message(
message=message,
customer_id=order.customer,
Expand Down
Loading