Skip to content

Commit

Permalink
Ref book (#3146)
Browse files Browse the repository at this point in the history
* get refbook

* get refbook

* black

* psycopg2
  • Loading branch information
urchinpro authored Oct 20, 2023
1 parent 1fb0e08 commit 0ded7d5
Show file tree
Hide file tree
Showing 3 changed files with 748 additions and 661 deletions.
33 changes: 33 additions & 0 deletions directory/sql_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,36 @@ def is_lab_filter_research(reserches_id):
)
rows = namedtuplefetchall(cursor)
return rows


def get_lab_research_reference_books():
with connection.cursor() as cursor:
cursor.execute(
"""
SELECT
directory_fractions.id as fraction_id,
directory_fractions.title as fraction_title,
directory_fractions.fsli as fraction_fsli,
directory_fractions.ref_m as fraction_ref_m,
directory_fractions.ref_f as fraction_ref_f,
du.title as unit_title,
du.code as unit_code,
du.ucum as unit_ucum,
dr.id as research_id,
dr.title as research_title,
dr.internal_code as research_internal_code,
dr.code as research_nmu_code
FROM directory_fractions
LEFT JOIN directory_researches dr on dr.id = directory_fractions.research_id
LEFT JOIN directory_unit du on du.id = directory_fractions.unit_id
LEFT JOIN podrazdeleniya_podrazdeleniya pp on dr.podrazdeleniye_id = pp.id
WHERE pp.p_type = 2
order by dr.id
""",
params={},
)
rows = namedtuplefetchall(cursor)
return rows
1 change: 1 addition & 0 deletions integration_framework/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@
path('get-value-field', views.get_value_field),
path('get-price-data', views.get_price_data),
path('get-prices-by-date', views.get_prices_by_date),
path('get-reference-books', views.get_reference_books),
]
Loading

0 comments on commit 0ded7d5

Please sign in to comment.