nordabiz/blueprints/pej_constants.py
Maciej Pienczyn 39965f68ee
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
fix(pej): use SessionLocal instead of db_session
The codebase uses SessionLocal() with try/finally pattern,
not db_session. Import error broke all blueprint registration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 18:30:24 +01:00

31 lines
823 B
Python

"""Shared constants and helpers for PEJ section."""
from database import SessionLocal, ZOPKProject
# Explicit slug list — easy to extend with SMR projects later
NUCLEAR_PROJECT_SLUGS = ['nuclear-plant']
LINK_TYPE_LABELS = {
'potential_supplier': 'Potencjalny dostawca',
'partner': 'Partner',
'investor': 'Inwestor',
'beneficiary': 'Beneficjent'
}
def get_nuclear_project_ids(db=None):
"""Return IDs of nuclear projects from ZOPK."""
close = False
if db is None:
db = SessionLocal()
close = True
try:
projects = db.query(ZOPKProject.id).filter(
ZOPKProject.slug.in_(NUCLEAR_PROJECT_SLUGS),
ZOPKProject.project_type == 'energy'
).all()
return [p.id for p in projects]
finally:
if close:
db.close()