Ajout de la distance dans les tableaux top #55
This commit is contained in:
+5
-4
@@ -9,8 +9,10 @@ def get_top_org_table(data, org_type: str):
|
|||||||
if dff.height == 0:
|
if dff.height == 0:
|
||||||
return html.Div()
|
return html.Div()
|
||||||
|
|
||||||
dff = dff.select(["uid", f"{org_type}_id", f"{org_type}_nom", "montant"])
|
dff = dff.select(
|
||||||
dff_nb = dff.group_by(f"{org_type}_id", f"{org_type}_nom").agg(
|
["uid", f"{org_type}_id", f"{org_type}_nom", "distance", "montant"]
|
||||||
|
)
|
||||||
|
dff_nb = dff.group_by(f"{org_type}_id", f"{org_type}_nom", "distance").agg(
|
||||||
pl.len().alias("Attributions"), pl.sum("montant").alias("montant")
|
pl.len().alias("Attributions"), pl.sum("montant").alias("montant")
|
||||||
)
|
)
|
||||||
dff_nb = dff_nb.sort(by="montant", descending=True)
|
dff_nb = dff_nb.sort(by="montant", descending=True)
|
||||||
@@ -23,14 +25,13 @@ def get_top_org_table(data, org_type: str):
|
|||||||
data = dff_nb.to_dicts()
|
data = dff_nb.to_dicts()
|
||||||
data = add_links_in_dict(data, f"{org_type}")
|
data = add_links_in_dict(data, f"{org_type}")
|
||||||
|
|
||||||
print(dff_nb)
|
|
||||||
|
|
||||||
return dash_table.DataTable(
|
return dash_table.DataTable(
|
||||||
data=data,
|
data=data,
|
||||||
markdown_options={"html": True},
|
markdown_options={"html": True},
|
||||||
page_action="native",
|
page_action="native",
|
||||||
page_size=10,
|
page_size=10,
|
||||||
columns=columns,
|
columns=columns,
|
||||||
|
cell_selectable=False,
|
||||||
tooltip_header=tooltip,
|
tooltip_header=tooltip,
|
||||||
style_cell_conditional=[
|
style_cell_conditional=[
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ def get_acheteur_marches_data(url, acheteur_year: str) -> list[dict]:
|
|||||||
"titulaire_id",
|
"titulaire_id",
|
||||||
"titulaire_typeIdentifiant",
|
"titulaire_typeIdentifiant",
|
||||||
"titulaire_nom",
|
"titulaire_nom",
|
||||||
|
"distance",
|
||||||
"montant",
|
"montant",
|
||||||
"codeCPV",
|
"codeCPV",
|
||||||
"dureeMois",
|
"dureeMois",
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ def get_titulaire_marches_data(url, titulaire_year: str) -> list[dict]:
|
|||||||
"dateNotification",
|
"dateNotification",
|
||||||
"acheteur_id",
|
"acheteur_id",
|
||||||
"acheteur_nom",
|
"acheteur_nom",
|
||||||
|
"distance",
|
||||||
"montant",
|
"montant",
|
||||||
"codeCPV",
|
"codeCPV",
|
||||||
"dureeMois",
|
"dureeMois",
|
||||||
|
|||||||
Reference in New Issue
Block a user