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()
|
all_releases = _get_releases()
|
||||||
latest_release = all_releases[0] if all_releases else None
|
latest_release = all_releases[0] if all_releases else None
|
||||||
|
|
||||||
# Latest forum topic for homepage
|
# Latest forum activity for homepage (newest reply or topic)
|
||||||
latest_forum_topic = None
|
latest_forum_reply = None
|
||||||
|
latest_forum_topic_for_reply = None
|
||||||
try:
|
try:
|
||||||
from database import ForumTopic
|
from database import ForumTopic, ForumReply
|
||||||
latest_forum_topic = db.query(ForumTopic).filter(
|
# Find the most recent reply
|
||||||
ForumTopic.is_deleted == False
|
latest_reply = db.query(ForumReply).filter(
|
||||||
).order_by(ForumTopic.created_at.desc()).first()
|
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:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# New members admitted at last board meeting
|
# New members — find newest board meeting that has admitted companies
|
||||||
latest_admitted = []
|
latest_admitted = []
|
||||||
last_meeting = None
|
last_meeting = None
|
||||||
try:
|
try:
|
||||||
from database import BoardMeeting
|
from database import BoardMeeting
|
||||||
last_meeting = db.query(BoardMeeting).order_by(BoardMeeting.meeting_date.desc()).first()
|
from sqlalchemy import exists
|
||||||
if last_meeting:
|
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(
|
latest_admitted = db.query(Company).filter(
|
||||||
Company.admitted_at_meeting_id == last_meeting.id
|
Company.admitted_at_meeting_id == last_meeting.id
|
||||||
).order_by(Company.name).all()
|
).order_by(Company.name).all()
|
||||||
@ -219,7 +235,8 @@ def index():
|
|||||||
latest_release=latest_release,
|
latest_release=latest_release,
|
||||||
company_children=company_children,
|
company_children=company_children,
|
||||||
company_parent=company_parent,
|
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,
|
latest_admitted=latest_admitted,
|
||||||
last_meeting=last_meeting
|
last_meeting=last_meeting
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1102,7 +1102,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Homepage Grid: Events + Forum + New Members -->
|
<!-- 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">
|
<div class="homepage-grid" data-animate="fadeIn">
|
||||||
|
|
||||||
<!-- LEFT COLUMN: 2 Events -->
|
<!-- LEFT COLUMN: 2 Events -->
|
||||||
@ -1154,20 +1154,21 @@
|
|||||||
<!-- RIGHT COLUMN: Forum + New Members -->
|
<!-- RIGHT COLUMN: Forum + New Members -->
|
||||||
<div style="display: flex; flex-direction: column; gap: var(--spacing-md);">
|
<div style="display: flex; flex-direction: column; gap: var(--spacing-md);">
|
||||||
|
|
||||||
<!-- Latest Forum Topic -->
|
<!-- Latest Forum Activity -->
|
||||||
{% if latest_forum_topic %}
|
{% if latest_forum_topic_for_reply %}
|
||||||
<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'">
|
<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;">
|
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
|
||||||
<span style="font-size: 1.2rem;">💬</span>
|
<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>
|
<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>
|
||||||
<div style="font-weight: 600; color: var(--text-primary); font-size: var(--font-size-base); line-height: 1.4; margin-bottom: 8px;">
|
<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>
|
||||||
<div style="font-size: var(--font-size-sm); color: var(--text-secondary);">
|
<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_reply %}
|
||||||
{% if latest_forum_topic.reply_count is defined and latest_forum_topic.reply_count > 0 %}
|
{{ latest_forum_reply.author.name if latest_forum_reply.author else 'Anonim' }} · {{ latest_forum_reply.created_at|local_time('%d.%m.%Y %H:%M') }}
|
||||||
· {{ latest_forum_topic.reply_count }} {{ 'odpowiedź' if latest_forum_topic.reply_count == 1 else ('odpowiedzi' if latest_forum_topic.reply_count < 5 else 'odpowiedzi') }}
|
{% 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 %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user