Spaces:
Sleeping
Sleeping
Update analytics/recommendation_engine.py
Browse files
analytics/recommendation_engine.py
CHANGED
|
@@ -173,15 +173,14 @@ def build_upcoming_hitter_recommendations(
|
|
| 173 |
|
| 174 |
recommendations.append(row)
|
| 175 |
|
|
|
|
| 176 |
recommendations = sorted(
|
| 177 |
recommendations,
|
| 178 |
-
key=lambda x: (
|
| 179 |
-
float(x.get("priority_score", 0.0) or 0.0),
|
| 180 |
-
float(x.get("confidence", 0.0) or 0.0),
|
| 181 |
-
),
|
| 182 |
-
reverse=True,
|
| 183 |
)
|
| 184 |
|
|
|
|
|
|
|
| 185 |
surfaced = [
|
| 186 |
row for row in recommendations
|
| 187 |
if str(row.get("recommendation_tier", "")).lower() in {"bet", "watch"}
|
|
|
|
| 173 |
|
| 174 |
recommendations.append(row)
|
| 175 |
|
| 176 |
+
# Preserve lineup-order display, but compute badges from model outputs.
|
| 177 |
recommendations = sorted(
|
| 178 |
recommendations,
|
| 179 |
+
key=lambda x: _lineup_distance_from_slot(x.get("slot", "")),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
)
|
| 181 |
|
| 182 |
+
recommendations = _apply_opportunity_badges(recommendations)
|
| 183 |
+
|
| 184 |
surfaced = [
|
| 185 |
row for row in recommendations
|
| 186 |
if str(row.get("recommendation_tier", "")).lower() in {"bet", "watch"}
|