remove trade offer expanding, fix flipping to work with new layout. all cards in trade offer are not expanded

This commit is contained in:
badblocks 2025-04-04 14:23:53 -07:00
parent c68d1fb5ec
commit 7c62c57433
11 changed files with 194 additions and 170 deletions

View file

@ -498,9 +498,9 @@ class TradeOfferPNGView(View):
trade_offer = get_object_or_404(TradeOffer, pk=kwargs['pk'])
# If the image is already generated and stored, serve it directly.
if trade_offer.image:
trade_offer.image.open()
return HttpResponse(trade_offer.image.read(), content_type="image/png")
# if trade_offer.image:
# trade_offer.image.open()
# return HttpResponse(trade_offer.image.read(), content_type="image/png")
# Acquire PostgreSQL advisory lock to prevent concurrent generation.
from django.db import connection
@ -509,10 +509,10 @@ class TradeOfferPNGView(View):
cursor.execute("SELECT pg_advisory_lock(%s)", [lock_key])
try:
# Double-check if the image was generated while waiting for the lock.
trade_offer.refresh_from_db()
if trade_offer.image:
trade_offer.image.open()
return HttpResponse(trade_offer.image.read(), content_type="image/png")
# trade_offer.refresh_from_db()
# if trade_offer.image:
# trade_offer.image.open()
# return HttpResponse(trade_offer.image.read(), content_type="image/png")
tag_context = render_trade_offer_png(
{'request': request}, trade_offer, show_friend_code=True