fix: show last activity date instead of creation date in Nowe na portalu
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

Forum cards now show date of latest reply (not topic creation).
B2B cards show updated_at (not created_at), sorted by most recent activity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-10 07:38:34 +02:00
parent a8dbfa7199
commit dc17352fe2
2 changed files with 8 additions and 8 deletions

View File

@ -210,7 +210,7 @@ def index():
).group_by(ForumTopic.id).order_by(
func.coalesce(func.max(ForumReply.created_at), ForumTopic.created_at).desc()
).limit(2).all()
latest_forum_topics = [t[0] for t in topics_with_activity]
latest_forum_topics = [{'topic': t[0], 'last_activity': t[1]} for t in topics_with_activity]
except Exception:
pass
@ -218,10 +218,11 @@ def index():
latest_classifieds = []
try:
from database import Classified
from sqlalchemy import func
latest_classifieds = db.query(Classified).filter(
Classified.is_active == True,
Classified.is_test == False
).order_by(Classified.created_at.desc()).limit(2).all()
).order_by(func.coalesce(Classified.updated_at, Classified.created_at).desc()).limit(2).all()
except Exception:
pass

View File

@ -1288,13 +1288,12 @@
<div class="new-on-portal" data-animate="fadeIn">
<h2>📋 Nowe na portalu</h2>
<div class="new-on-portal-grid">
{% for topic in latest_forum_topics %}
<a href="{{ url_for('forum.forum_topic', topic_id=topic.id) }}" class="new-card">
{% for item in latest_forum_topics %}
<a href="{{ url_for('forum.forum_topic', topic_id=item.topic.id) }}" class="new-card">
<span class="new-card-badge forum">💬 Forum</span>
<div class="new-card-title">{{ topic.title }}</div>
<div class="new-card-title">{{ item.topic.title }}</div>
<div class="new-card-meta">
{{ topic.author.name if topic.author else 'Anonim' }} · {{ topic.created_at|local_time('%d.%m.%Y') }}
{% if topic.replies_count is defined and topic.replies_count %}· {{ topic.replies_count }} odp.{% endif %}
{{ item.topic.author.name if item.topic.author else 'Anonim' }} · {{ item.last_activity|local_time('%d.%m.%Y') }}
</div>
</a>
{% endfor %}
@ -1303,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 %}