fix: views_count increment no longer triggers updated_at on classifieds
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Use raw SQL UPDATE for views_count to bypass SQLAlchemy onupdate. Restore updated_at display in homepage cards - now accurate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8dcf4de146
commit
79c76b1337
@ -166,8 +166,12 @@ def view(classified_id):
|
||||
flash('Ogłoszenie nie istnieje.', 'error')
|
||||
return redirect(url_for('.classifieds_index'))
|
||||
|
||||
# Zwiększ licznik wyświetleń (handle NULL)
|
||||
classified.views_count = (classified.views_count or 0) + 1
|
||||
# Zwiększ licznik wyświetleń bez triggerowania updated_at
|
||||
db.execute(
|
||||
Classified.__table__.update().where(Classified.id == classified_id).values(
|
||||
views_count=(Classified.views_count + 1)
|
||||
)
|
||||
)
|
||||
|
||||
# Zapisz odczyt przez zalogowanego użytkownika
|
||||
existing_read = db.query(ClassifiedRead).filter(
|
||||
|
||||
@ -1302,7 +1302,7 @@
|
||||
<span class="new-card-badge b2b">🏢 B2B {% if cl.listing_type == 'szukam' %}Szukam{% else %}Oferuję{% endif %}</span>
|
||||
<div class="new-card-title">{{ cl.title }}</div>
|
||||
<div class="new-card-meta">
|
||||
{{ cl.author.name if cl.author else 'Anonim' }} · {{ cl.created_at|local_time('%d.%m.%Y') }}
|
||||
{{ cl.author.name if cl.author else 'Anonim' }} · {{ (cl.updated_at or cl.created_at)|local_time('%d.%m.%Y') }}
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user