fix: add undo disk selection capability #2
@@ -111,13 +111,13 @@ async def generate_plot_endpoint(
|
|||||||
|
|
||||||
# Determine metrics
|
# Determine metrics
|
||||||
available = sorted(df["metric"].unique())
|
available = sorted(df["metric"].unique())
|
||||||
if request.metric:
|
if metric:
|
||||||
if request.metric not in available:
|
if metric not in available:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
detail=f"Metric {request.metric} not found"
|
detail=f"Metric {metric} not found"
|
||||||
)
|
)
|
||||||
metrics = [request.metric]
|
metrics = [metric]
|
||||||
else:
|
else:
|
||||||
totals = df.groupby("metric")["count"].sum().sort_values(ascending=False)
|
totals = df.groupby("metric")["count"].sum().sort_values(ascending=False)
|
||||||
metrics = [totals.index[0]]
|
metrics = [totals.index[0]]
|
||||||
|
|||||||
Reference in New Issue
Block a user