Skip to content

Commit

Permalink
Merge pull request #4012 from mikhailprivalov/fixResulLabForm
Browse files Browse the repository at this point in the history
fix-ы
  • Loading branch information
Wellheor1 authored Jun 29, 2024
2 parents 1865c8c + 419396f commit 32c33ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ftp_orders/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def pull_result(self, file: str):
iss.save()

for res in result:
fraction = Fractions.objects.filter(fsli=res["fsli"]).first()
fraction = Fractions.objects.filter(fsli=res["fsli"], research__hide=False, research__podrazdeleniye__p_type=2).first()
if not fraction:
continue
value = res["value"]
Expand Down
21 changes: 17 additions & 4 deletions results/laboratory_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from reportlab.lib.styles import getSampleStyleSheet
from copy import deepcopy
from reportlab.lib.enums import TA_CENTER, TA_JUSTIFY, TA_LEFT
from operator import itemgetter


def default_lab_form(fwb, interactive_text_field, pw, direction, styleSheet, directory, show_norm, stl, print_vtype, get_r, result_normal):
Expand Down Expand Up @@ -575,16 +576,28 @@ def lab_form_1(fwb, interactive_text_field, pw, direction, styleSheet, directory
pks.append(iss.pk)
data = []
fractions = directory.Fractions.objects.filter(research=iss.research, hide=False, render_type=0).order_by("pk").order_by("sort_weight")
results_iss = Result.objects.filter(issledovaniye=iss).order_by("fraction__sort_weight") # Выборка результатов из базы

# проверить записанные результаты со справочником из Услуги названия
fractions_set = set([f.fraction for f in results_iss])
fractions_orders = [[fs.sort_weight, fs] for fs in fractions_set]
sorted_data = sorted(fractions_orders, key=itemgetter(0))
fractions_tmp = [s[1] for s in sorted_data]

fraction_compare = [el for el in fractions_tmp if el not in fractions]
if len(fraction_compare) > 0:
fractions = fraction_compare

if iss.api_app:
laboratory_analyzer_data.append(iss.api_app.name)

if fractions.count() > 0:
if fractions.count() == 1:
if len(fractions) > 0:
if len(fractions) == 1:
tmp = [Paragraph('<font face="FreeSans" size="8">' + iss.research.title + "</font>", styleSheet["BodyText"])]
norm = "none"
sign = RANGE_IN
if Result.objects.filter(issledovaniye=iss, fraction=fractions[0]).exists():
r = Result.objects.filter(issledovaniye=iss, fraction=fractions[0]).order_by("-pk")[0]
if len(fractions) > 0:
r = fractions[0]
ref = r.get_ref()
if show_norm:
norm, sign, ref_res = r.get_is_norm(recalc=True, with_ref=True)
Expand Down

0 comments on commit 32c33ce

Please sign in to comment.