mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-22 16:12:55 +02:00
Added a small stability fix. (#374)
The current code has problems with an empty db.
This commit is contained in:
parent
24c55c68b7
commit
19a4460d90
@ -134,8 +134,12 @@ def layout() -> list[html]:
|
|||||||
"""Generates the Layout of the Homepage."""
|
"""Generates the Layout of the Homepage."""
|
||||||
person_relation_types = person_relation_type_filter()
|
person_relation_types = person_relation_type_filter()
|
||||||
company_relation_types = company_relation_type_filter()
|
company_relation_types = company_relation_type_filter()
|
||||||
selected_company_relation_types: frozenset[str] = frozenset(
|
selected_company_relation_types: frozenset[str] = (
|
||||||
{company_relation_types[1]}
|
frozenset(
|
||||||
|
{company_relation_types[1]} if company_relation_types else frozenset({})
|
||||||
|
)
|
||||||
|
if company_relation_types
|
||||||
|
else frozenset({})
|
||||||
)
|
)
|
||||||
selected_person_relation_types: frozenset[str] = frozenset(
|
selected_person_relation_types: frozenset[str] = frozenset(
|
||||||
{}
|
{}
|
||||||
|
@ -3,7 +3,6 @@ from functools import lru_cache
|
|||||||
|
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from loguru import logger
|
|
||||||
from sqlalchemy.orm import aliased
|
from sqlalchemy.orm import aliased
|
||||||
|
|
||||||
from aki_prj23_transparenzregister.ui.session_handler import SessionHandler
|
from aki_prj23_transparenzregister.ui.session_handler import SessionHandler
|
||||||
@ -155,11 +154,9 @@ def filter_relation_type(
|
|||||||
relation_dataframe (pd.DataFrame): The filtered DataFrame which now only contains entries with the selected Relation Type.
|
relation_dataframe (pd.DataFrame): The filtered DataFrame which now only contains entries with the selected Relation Type.
|
||||||
"""
|
"""
|
||||||
if selected_relation_type is not None:
|
if selected_relation_type is not None:
|
||||||
filtered = relation_dataframe.loc[
|
return relation_dataframe.loc[
|
||||||
relation_dataframe["relation_type"].isin(selected_relation_type)
|
relation_dataframe["relation_type"].isin(selected_relation_type)
|
||||||
]
|
]
|
||||||
logger.info(f"Filtered! {len(filtered.index) / len(relation_dataframe)}")
|
|
||||||
return filtered
|
|
||||||
return relation_dataframe
|
return relation_dataframe
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user