Skip to content

Commit

Permalink
Merge branch 'develop' into fix-short-title
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro authored Jun 19, 2024
2 parents db88878 + 892e11f commit bb57050
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
17 changes: 15 additions & 2 deletions api/directions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@
from laboratory import settings
from laboratory import utils
from laboratory.decorators import group_required
from laboratory.settings import DICOM_SERVER, TIME_ZONE, REMD_ONLY_RESEARCH, REMD_EXCLUDE_RESEARCH, SHOW_EXAMINATION_DATE_IN_PARACLINIC_RESULT_PAGE, DICOM_SERVERS
from laboratory.settings import (
DICOM_SERVER,
TIME_ZONE,
REMD_ONLY_RESEARCH,
REMD_EXCLUDE_RESEARCH,
SHOW_EXAMINATION_DATE_IN_PARACLINIC_RESULT_PAGE,
DICOM_SERVERS,
TUBE_MAX_RESEARCH_WITH_SHARE,
)
from laboratory.utils import current_year, strdateru, strdatetime, strdate, strdatetimeru, strtime, tsdatetime, start_end_year, strfdatetime, current_time, replace_tz
from pharmacotherapy.models import ProcedureList, ProcedureListTimes, Drugs, FormRelease, MethodsReception
from results.sql_func import get_not_confirm_direction, get_laboratory_results_by_directions
Expand Down Expand Up @@ -3562,11 +3570,16 @@ def tubes_for_get(request):
vrpk = absor.fupper.relation_id
rel = absor.fupper.relation

if rel.max_researches_per_tube:
if rel.max_researches_per_tube and not TUBE_MAX_RESEARCH_WITH_SHARE:
actual_count = relation_researches_count.get(rel.pk, 0) + 1
relation_researches_count[rel.pk] = actual_count
chunk_number = math.ceil(actual_count / rel.max_researches_per_tube)
vrpk = f"{vrpk}_{chunk_number}"
elif v.research.count_volume_material_for_tube and TUBE_MAX_RESEARCH_WITH_SHARE:
actual_volume_share = relation_researches_count.get(rel.pk, 0) + v.research.count_volume_material_for_tube
relation_researches_count[rel.pk] = actual_volume_share
chunk_number = math.ceil(actual_volume_share / 1)
vrpk = f"{vrpk}_{chunk_number}"
else:
chunk_number = None

Expand Down
16 changes: 12 additions & 4 deletions barcodes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from appconf.manager import SettingManager
from directions.models import Napravleniya, Issledovaniya, TubesRegistration, NumberGenerator, NoGenerator, GeneratorValuesAreOver
from laboratory.decorators import group_required
from laboratory.settings import FONTS_FOLDER, BARCODE_SIZE
from laboratory.settings import FONTS_FOLDER, BARCODE_SIZE, TUBE_MAX_RESEARCH_WITH_SHARE, TUBE_BARCODE_OFFSET_X, TUBE_BARCODE_WIDTH_MINDEX
from users.models import DoctorProfile
from laboratory.utils import strdate
from reportlab.graphics.shapes import Drawing
Expand Down Expand Up @@ -134,11 +134,16 @@ def tubes(request, direction_implict_id=None):
vrpk = absor.fupper.relation_id
rel = absor.fupper.relation

if rel.max_researches_per_tube:
if rel.max_researches_per_tube and not TUBE_MAX_RESEARCH_WITH_SHARE:
actual_count = relation_researches_count.get(rel.pk, 0) + 1
relation_researches_count[rel.pk] = actual_count
chunk_number = math.ceil(actual_count / rel.max_researches_per_tube)
vrpk = f"{vrpk}_{chunk_number}"
elif v.research.count_volume_material_for_tube and TUBE_MAX_RESEARCH_WITH_SHARE:
actual_volume_share = relation_researches_count.get(rel.pk, 0) + v.research.count_volume_material_for_tube
relation_researches_count[rel.pk] = actual_volume_share
chunk_number = math.ceil(actual_volume_share / 1)
vrpk = f"{vrpk}_{chunk_number}"
else:
chunk_number = None

Expand Down Expand Up @@ -228,9 +233,12 @@ def tubes(request, direction_implict_id=None):
if tube >= 1000000:
m = 0.016
if tube >= 10000000000:
m = 0.013
m = TUBE_BARCODE_WIDTH_MINDEX
barcode = code128.Code128(str(tube), barHeight=ph * mm - 12 * mm, barWidth=pw / 43 * inch * m)
barcode.drawOn(c, -3 * mm, 4 * mm)
if tube >= 10000000000:
barcode.drawOn(c, TUBE_BARCODE_OFFSET_X * mm, 4 * mm)
else:
barcode.drawOn(c, -3 * mm, 4 * mm)

c.showPage()
c.save()
Expand Down
4 changes: 3 additions & 1 deletion laboratory/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ def __getitem__(self, item):
ROUTE_LIST_ROW_HEIGHTS = 25
OWN_SETUP_TO_SEND_FTP_EXECUTOR = False
FORMS_LABORATORY_DIRECTION_DEFAULT = ""

TUBE_MAX_RESEARCH_WITH_SHARE = False
TUBE_BARCODE_OFFSET_X = 1
TUBE_BARCODE_WIDTH_MINDEX = 0.0125

FCM_CERT_PATH = ""
PROMETHEUS_ENABLED = False
Expand Down

0 comments on commit bb57050

Please sign in to comment.