generated from dopt-python/py311
re-enable company profile
This commit is contained in:
@@ -75,7 +75,8 @@ def initrec_comp_search_choices() -> tuple[tuple[str, int], ...]:
|
||||
return tuple(zip(df["dedupl"], df["ma_id"]))
|
||||
|
||||
|
||||
def initrec_comp_search_get_info(
|
||||
# TODO change to direct SQL interaction
|
||||
def external_company_get_info(
|
||||
ma_id: ExtMaId,
|
||||
) -> CompanyInfo:
|
||||
logger.debug("[Call backend] comp_search_get_info")
|
||||
@@ -858,11 +859,11 @@ def page_consulting_linking_companies(
|
||||
|
||||
with db.ENGINE.connect() as conn:
|
||||
q_relevant_companies = sa.select(
|
||||
db.grunderfassung_unternehmen.c.un_id,
|
||||
db.grunderfassung_unternehmen.c.Partnersuche__un_suche,
|
||||
db.t_unternehmen.c.un_id,
|
||||
db.t_unternehmen.c.Partnersuche__un_suche,
|
||||
).where(
|
||||
db.grunderfassung_unternehmen.c.geloescht.is_(None),
|
||||
db.grunderfassung_unternehmen.c.Partnersuche__un_suche.is_not(None),
|
||||
db.t_unternehmen.c.geloescht.is_(None),
|
||||
db.t_unternehmen.c.Partnersuche__un_suche.is_not(None),
|
||||
)
|
||||
if un_id is not None:
|
||||
q_relevant_companies = q_relevant_companies.where(
|
||||
@@ -904,6 +905,8 @@ def page_consulting_linking_companies(
|
||||
def page_consulting_linking_persons(
|
||||
un_id: RecId | None,
|
||||
) -> list[LinkingConsultationsEntryPerson]:
|
||||
raise RuntimeError("TODOs to implement")
|
||||
|
||||
with db.ENGINE.connect() as conn:
|
||||
# if un_id None: list all persons
|
||||
# else: list just the persons associated with the company
|
||||
@@ -958,6 +961,7 @@ def page_consulting_eastablish_link(
|
||||
un_id: RecId | None,
|
||||
pers_id: RecId | None,
|
||||
) -> None:
|
||||
raise RuntimeError("TODOs to implement")
|
||||
|
||||
stmt = (
|
||||
sa.update(db.t_beratung_vorgang)
|
||||
@@ -969,6 +973,7 @@ def page_consulting_eastablish_link(
|
||||
conn.execute(stmt)
|
||||
|
||||
|
||||
# // company profile interaction
|
||||
def companyprofile_page_get_consultations(
|
||||
un_id: RecId,
|
||||
) -> CompanyProfileConsultations:
|
||||
@@ -994,11 +999,8 @@ def companyprofile_page_get_consultations(
|
||||
|
||||
datetime_updated = cast(datetime.datetime, entry["aktualisiert"])
|
||||
datetime_updated = datetime_updated.astimezone(TIMEZONE_CEST)
|
||||
|
||||
base_title = entry["titel"]
|
||||
|
||||
_cons_type = entry["beratungs_typ"]
|
||||
cons_type = ConsultingType(_cons_type)
|
||||
cons_type = ConsultingType(entry["beratungs_typ"])
|
||||
|
||||
con_entry = CompanyProfileConsultationEntry(
|
||||
cons_id=cons_id,
|
||||
@@ -1012,7 +1014,7 @@ def companyprofile_page_get_consultations(
|
||||
elif cons_type is ConsultingType.INDIVIDUAL:
|
||||
cons_entries_individual.append(con_entry)
|
||||
else:
|
||||
raise TypeError(f"Unknown consulting type: {_cons_type}")
|
||||
raise TypeError(f"Unknown consulting type: {cons_type}")
|
||||
|
||||
cons_entries_pauschal.sort(key=lambda x: x.date_updated, reverse=True)
|
||||
cons_entries_individual.sort(key=lambda x: x.date_updated, reverse=True)
|
||||
@@ -1081,7 +1083,7 @@ def _main_page_get_company_list() -> list[MainPageEntry]:
|
||||
datetime_akt = cast(datetime.datetime, entry["Metadaten_aktualisierung"])
|
||||
datetime_akt = datetime_akt.astimezone(TIMEZONE_CEST)
|
||||
|
||||
comp_info = initrec_comp_search_get_info(ma_id_external)
|
||||
comp_info = external_company_get_info(ma_id_external)
|
||||
display_name = comp_info["ma_unternehmensname"]
|
||||
|
||||
main_page_companies.append(
|
||||
|
||||
Reference in New Issue
Block a user