fix(homepage): forum shows latest reply, members from newest meeting with admissions
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
- Forum tile: show newest reply (author + date), not newest topic creation - New members: find newest board meeting that actually has admitted companies - Fix events-row container for proper filter rendering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
28e91022c5
commit
11124d2711
@ -182,23 +182,39 @@ def index():
|
||||
all_releases = _get_releases()
|
||||
latest_release = all_releases[0] if all_releases else None
|
||||
|
||||
# Latest forum topic for homepage
|
||||
latest_forum_topic = None
|
||||
# Latest forum activity for homepage (newest reply or topic)
|
||||
latest_forum_reply = None
|
||||
latest_forum_topic_for_reply = None
|
||||
try:
|
||||
from database import ForumTopic
|
||||
latest_forum_topic = db.query(ForumTopic).filter(
|
||||
ForumTopic.is_deleted == False
|
||||
).order_by(ForumTopic.created_at.desc()).first()
|
||||
from database import ForumTopic, ForumReply
|
||||
# Find the most recent reply
|
||||
latest_reply = db.query(ForumReply).filter(
|
||||
ForumReply.is_deleted == False
|
||||
).order_by(ForumReply.created_at.desc()).first()
|
||||
if latest_reply:
|
||||
latest_forum_reply = latest_reply
|
||||
latest_forum_topic_for_reply = latest_reply.topic
|
||||
else:
|
||||
# No replies — fall back to newest topic
|
||||
newest_topic = db.query(ForumTopic).filter(
|
||||
ForumTopic.is_deleted == False
|
||||
).order_by(ForumTopic.created_at.desc()).first()
|
||||
if newest_topic:
|
||||
latest_forum_topic_for_reply = newest_topic
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# New members admitted at last board meeting
|
||||
# New members — find newest board meeting that has admitted companies
|
||||
latest_admitted = []
|
||||
last_meeting = None
|
||||
try:
|
||||
from database import BoardMeeting
|
||||
last_meeting = db.query(BoardMeeting).order_by(BoardMeeting.meeting_date.desc()).first()
|
||||
if last_meeting:
|
||||
from sqlalchemy import exists
|
||||
meetings_with_admissions = db.query(BoardMeeting).filter(
|
||||
exists().where(Company.admitted_at_meeting_id == BoardMeeting.id)
|
||||
).order_by(BoardMeeting.meeting_date.desc()).first()
|
||||
if meetings_with_admissions:
|
||||
last_meeting = meetings_with_admissions
|
||||
latest_admitted = db.query(Company).filter(
|
||||
Company.admitted_at_meeting_id == last_meeting.id
|
||||
).order_by(Company.name).all()
|
||||
@ -219,7 +235,8 @@ def index():
|
||||
latest_release=latest_release,
|
||||
company_children=company_children,
|
||||
company_parent=company_parent,
|
||||
latest_forum_topic=latest_forum_topic,
|
||||
latest_forum_reply=latest_forum_reply,
|
||||
latest_forum_topic_for_reply=latest_forum_topic_for_reply,
|
||||
latest_admitted=latest_admitted,
|
||||
last_meeting=last_meeting
|
||||
)
|
||||
|
||||
@ -1102,7 +1102,7 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Homepage Grid: Events + Forum + New Members -->
|
||||
{% if upcoming_events or latest_forum_topic or latest_admitted %}
|
||||
{% if upcoming_events or latest_forum_topic_for_reply or latest_admitted %}
|
||||
<div class="homepage-grid" data-animate="fadeIn">
|
||||
|
||||
<!-- LEFT COLUMN: 2 Events -->
|
||||
@ -1154,20 +1154,21 @@
|
||||
<!-- RIGHT COLUMN: Forum + New Members -->
|
||||
<div style="display: flex; flex-direction: column; gap: var(--spacing-md);">
|
||||
|
||||
<!-- Latest Forum Topic -->
|
||||
{% if latest_forum_topic %}
|
||||
<a href="{{ url_for('forum.forum_topic', topic_id=latest_forum_topic.id) }}" style="text-decoration: none; display: block; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--spacing-md); transition: all 0.2s; min-height: 120px;" onmouseover="this.style.borderColor='var(--primary)';this.style.boxShadow='0 2px 8px rgba(0,0,0,0.08)'" onmouseout="this.style.borderColor='var(--border)';this.style.boxShadow='none'">
|
||||
<!-- Latest Forum Activity -->
|
||||
{% if latest_forum_topic_for_reply %}
|
||||
<a href="{{ url_for('forum.forum_topic', topic_id=latest_forum_topic_for_reply.id) }}" style="text-decoration: none; display: block; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--spacing-md); transition: all 0.2s; min-height: 120px;" onmouseover="this.style.borderColor='var(--primary)';this.style.boxShadow='0 2px 8px rgba(0,0,0,0.08)'" onmouseout="this.style.borderColor='var(--border)';this.style.boxShadow='none'">
|
||||
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
|
||||
<span style="font-size: 1.2rem;">💬</span>
|
||||
<span style="font-size: var(--font-size-xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;">Najnowszy wpis na forum</span>
|
||||
</div>
|
||||
<div style="font-weight: 600; color: var(--text-primary); font-size: var(--font-size-base); line-height: 1.4; margin-bottom: 8px;">
|
||||
{{ latest_forum_topic.title }}
|
||||
{{ latest_forum_topic_for_reply.title }}
|
||||
</div>
|
||||
<div style="font-size: var(--font-size-sm); color: var(--text-secondary);">
|
||||
{{ latest_forum_topic.author.name if latest_forum_topic.author else 'Anonim' }} · {{ latest_forum_topic.created_at|local_time('%d.%m.%Y %H:%M') }}
|
||||
{% if latest_forum_topic.reply_count is defined and latest_forum_topic.reply_count > 0 %}
|
||||
· {{ latest_forum_topic.reply_count }} {{ 'odpowiedź' if latest_forum_topic.reply_count == 1 else ('odpowiedzi' if latest_forum_topic.reply_count < 5 else 'odpowiedzi') }}
|
||||
{% if latest_forum_reply %}
|
||||
{{ latest_forum_reply.author.name if latest_forum_reply.author else 'Anonim' }} · {{ latest_forum_reply.created_at|local_time('%d.%m.%Y %H:%M') }}
|
||||
{% else %}
|
||||
{{ latest_forum_topic_for_reply.author.name if latest_forum_topic_for_reply.author else 'Anonim' }} · {{ latest_forum_topic_for_reply.created_at|local_time('%d.%m.%Y %H:%M') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user