mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-05-13 09:58:47 +02:00
parent
c2f6a2d9f6
commit
6ccf2ffd17
@ -134,7 +134,7 @@ def main() -> None:
|
|||||||
configer_logger(namespace=parsed)
|
configer_logger(namespace=parsed)
|
||||||
config = parsed.config
|
config = parsed.config
|
||||||
SessionHandler.session = connector.get_session(get_config_provider(config))
|
SessionHandler.session = connector.get_session(get_config_provider(config))
|
||||||
app.run(debug=False)
|
app.run()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -122,14 +122,13 @@ def get_options(session: Session | None) -> dict[int, str]:
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
persons = get_person_data(session).rename("p_{}".format)
|
persons = get_person_data(session).rename("p_{}".format)
|
||||||
persons[
|
logger.info(persons.items())
|
||||||
"person_lastname_firstname"
|
persons_options = persons.apply(
|
||||||
] = f"{persons['person_lastname']}, {persons['person_firstname']}"
|
lambda row: f"{row['person_lastname']}, {row['person_firstname']}", axis=1
|
||||||
persons_options = persons["person_lastname_firstname"]
|
)
|
||||||
companies = get_company_data(session).rename("c_{}".format)
|
companies = get_company_data(session).rename("c_{}".format)
|
||||||
companies_options = companies["company_name"]
|
companies_options = companies["company_name"]
|
||||||
all_options = pd.concat([persons_options, companies_options])
|
all_options = pd.concat([persons_options, companies_options])
|
||||||
|
|
||||||
return all_options.sort_values(ascending=True).to_dict()
|
return all_options.sort_values(ascending=True).to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Tests for ui elements."""
|
"""Tests for ui elements."""
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import pytest
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from aki_prj23_transparenzregister.ui import data_elements
|
from aki_prj23_transparenzregister.ui import data_elements
|
||||||
@ -111,3 +112,19 @@ def test_get_news_of_one_company1(news_db: Session) -> None:
|
|||||||
"title": "AI Revolution in Tech",
|
"title": "AI Revolution in Tech",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.working_on()
|
||||||
|
def test_options(full_db: Session) -> None:
|
||||||
|
"""Tests if the options can be generated."""
|
||||||
|
options = data_elements.get_options(full_db)
|
||||||
|
assert options == {
|
||||||
|
"c_1": "Some Company GmbH",
|
||||||
|
"c_2": "Other Company GmbH",
|
||||||
|
"c_3": "Third Company GmbH",
|
||||||
|
"p_1": "Mustermann, Max",
|
||||||
|
"p_2": "Mustermann, Sabine",
|
||||||
|
"p_3": "Some Surname, Some Firstname",
|
||||||
|
"p_4": "Some Surname, Some Firstname",
|
||||||
|
"p_5": "Other Surname, Other Firstname",
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user