Skip to content

Commit

Permalink
Merge pull request #4144 from mikhailprivalov/fix_s_pdf
Browse files Browse the repository at this point in the history
fix save pdf
  • Loading branch information
Wellheor1 authored Jul 30, 2024
2 parents a140690 + d0ae884 commit 1e16e6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/directions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4429,7 +4429,7 @@ def file_log(request):
rows.append(
{
'pk': row.pk,
'author': row.who_add_files.get_fio(),
'author': row.who_add_files.get_fio() if row.who_add_files else "-",
'createdAt': strfdatetime(row.created_at, "%d.%m.%Y %X"),
'file': row.uploaded_file.url if row.uploaded_file else None,
'fileName': os.path.basename(row.uploaded_file.name) if row.uploaded_file else None,
Expand Down
4 changes: 3 additions & 1 deletion ftp_orders/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def pull_result(self, file: str):

for obx in obxes:
tmp_fractions = fractions.copy()
if (obx.OBX.obx_3.obx_3_1.value).lower == "pdf":
if (obx.OBX.obx_3.obx_3_1.value).lower() == "pdf":
pdf_base_64 = obx.OBX.obx_5.obx_5_5.value
base64_bytes = pdf_base_64.encode('utf-8')
data = ContentFile(base64.b64decode(base64_bytes))
Expand All @@ -430,6 +430,7 @@ def pull_result(self, file: str):
for iss_file in iss_files:
iss_file.delete()
iss_file = IssledovaniyaFiles(issledovaniye=iss, uploaded_file=data)

file_name_internal_code = internal_code.replace(".", "_")
iss_file.uploaded_file.name = f"{tube_number}_{file_name_internal_code}.pdf"
iss_file.save()
Expand Down Expand Up @@ -465,6 +466,7 @@ def pull_result(self, file: str):
self.copy_file(file, iss.napravleniye.hospital.result_push_by_numbers)
self.copy_file(file, FTP_PATH_TO_SAVE)
self.delete_file(file)
return
if is_confirm:
iss.lab_comment = ""
iss.time_confirmation = datetime.datetime.strptime(date_time_confirm, "%Y%m%d%H%M%S")
Expand Down

0 comments on commit 1e16e6e

Please sign in to comment.