Skip to content

Commit

Permalink
feat: updates from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdelabre committed Oct 15, 2024
1 parent eb46c6a commit 3b43983
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dataclasses import dataclass
from typing import Optional

import huggy.schemas.offer as o
Expand All @@ -9,6 +10,7 @@
from sqlalchemy.ext.asyncio import AsyncSession


@dataclass
class ModelEngineOut:
model: ModelEngine
results: list[str]
Expand Down Expand Up @@ -44,7 +46,7 @@ async def handle_prediction(
results = await model_engine.get_scoring(db)

# Handle fallback scenario if enabled and no results are found
if use_fallback and not results:
if use_fallback and len(results) == 0:
model_engine = await ModelEngineFactory._handle_fallback(
user, params_in, call_id, input_offers
)
Expand Down
2 changes: 1 addition & 1 deletion apps/recommendation/api/src/huggy/core/scorer/offer.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ async def get_nearest_offers(
multiple_item_offers = []

offer_latitude, offer_longitude = await self.get_mean_offer_coordinates(
db, input_offers
input_offers
)

for v in recommendable_items_ids.values():
Expand Down
2 changes: 1 addition & 1 deletion apps/recommendation/api/src/huggy/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def playlist_recommendation(
model_engine_out: ModelEngineOut = await ModelEngineFactory.handle_prediction(
db,
user=user,
playlist_params=playlist_params,
params_in=playlist_params,
call_id=call_id,
context="recommendation",
input_offers=input_offers,
Expand Down
2 changes: 1 addition & 1 deletion apps/recommendation/api/src/huggy/views/offer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async def __similar_offers(
model_engine_out: ModelEngineOut = await ModelEngineFactory.handle_prediction(
db,
user=user,
playlist_params=playlist_params,
params_in=playlist_params,
call_id=call_id,
context="similar_offer",
input_offers=input_offers,
Expand Down

0 comments on commit 3b43983

Please sign in to comment.