Fix KeyError: 'price' in auction _price_dist_chart — compute on the fly
This commit is contained in:
@@ -40,6 +40,8 @@ def _price_dist_chart(proj):
|
|||||||
if proj is None:
|
if proj is None:
|
||||||
return go.Figure()
|
return go.Figure()
|
||||||
df = proj.copy()
|
df = proj.copy()
|
||||||
|
if "price" not in df.columns:
|
||||||
|
df["price"] = df.apply(lambda r: max(1.2, float(r.get("fvm", 100)) / 65.0) * float(r["qi"]) * (1.15 if r.get("role") == "A" else (0.95 if r.get("role") == "P" else 1.0)), axis=1)
|
||||||
df["price"] = df["price"].fillna(0)
|
df["price"] = df["price"].fillna(0)
|
||||||
fig = go.Figure()
|
fig = go.Figure()
|
||||||
for role, color in ROLE_COLORS.items():
|
for role, color in ROLE_COLORS.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user