Skip to content

Commit

Permalink
Update offers on film update
Browse files Browse the repository at this point in the history
  • Loading branch information
booxter committed Nov 22, 2024
1 parent f2682ed commit 785b8f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/letsrolld/cmd/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def offer_threshold(f):
return multiplier
# refresh offers for newer films more often
multiplier = max(0, _NOW.year - year(f)) + 1
# cap the multiplier at 14 (weeks)
# cap the multiplier at 14 days
return min(14, multiplier)


Expand Down Expand Up @@ -227,6 +227,9 @@ def refresh_film(session, db_obj, api_obj):
update_genres(session, api_obj.genres)
update_countries(session, api_obj.countries)

# Since we have all the data by virtue of pulling genres, update offers too
refresh_offers(session, db_obj, api_obj)

if not math.isclose(float(api_obj.rating), db_obj.rating):
print(f"\t{db_obj.rating:.3f} -> {api_obj.rating}")

Expand Down

0 comments on commit 785b8f2

Please sign in to comment.