author-topic-filter-fix
Some checks failed
Deploy on push / deploy (push) Failing after 2m2s

This commit is contained in:
2025-09-03 12:44:24 +03:00
parent c24d3a4b70
commit f99f14759c
2 changed files with 13 additions and 33 deletions

View File

@@ -15,37 +15,7 @@ The platform supports the following OAuth providers:
## Environment Variables
Add the following environment variables to your `.env` file:
```bash
# Google OAuth
OAUTH_CLIENTS_GOOGLE_ID=your_google_client_id
OAUTH_CLIENTS_GOOGLE_KEY=your_google_client_secret
# GitHub OAuth
OAUTH_CLIENTS_GITHUB_ID=your_github_client_id
OAUTH_CLIENTS_GITHUB_KEY=your_github_client_secret
# Facebook OAuth
OAUTH_CLIENTS_FACEBOOK_ID=your_facebook_app_id
OAUTH_CLIENTS_FACEBOOK_KEY=your_facebook_app_secret
# X (Twitter) OAuth
OAUTH_CLIENTS_X_ID=your_x_client_id
OAUTH_CLIENTS_X_KEY=your_x_client_secret
# Telegram OAuth
OAUTH_CLIENTS_TELEGRAM_ID=your_telegram_bot_token
OAUTH_CLIENTS_TELEGRAM_KEY=your_telegram_bot_secret
# VK OAuth
OAUTH_CLIENTS_VK_ID=your_vk_app_id
OAUTH_CLIENTS_VK_KEY=your_vk_secure_key
# Yandex OAuth
OAUTH_CLIENTS_YANDEX_ID=your_yandex_client_id
OAUTH_CLIENTS_YANDEX_KEY=your_yandex_client_secret
```
Add the needed environment variables to your `.env` file
## Provider Setup Instructions

View File

@@ -182,6 +182,9 @@ async def get_authors_with_stats(
.where(Shout.published_at.is_not(None))
.distinct() # Избегаем дубликатов авторов
)
# Указываем что фильтр применен, чтобы избежать сброса сортировки по умолчанию
default_sort_applied = True
logger.debug(f"✅ Topic filter applied for: {topic_value}")
# Применяем фильтрацию по параметрам из by
if by:
@@ -196,7 +199,9 @@ async def get_authors_with_stats(
# vars for statistics sorting
stats_sort_field = None
default_sort_applied = False
# НЕ сбрасываем default_sort_applied если он уже установлен для фильтра по топику
if not default_sort_applied:
default_sort_applied = False
if by:
if "order" in by:
@@ -674,7 +679,12 @@ async def get_authors_with_stats(
raise
# Используем универсальную функцию для кеширования запросов
cached_result = await cached_query(cache_key, fetch_authors_with_stats)
# Для фильтра по топику принудительно обновляем кеш (временное решение для отладки)
force_refresh = by is not None and by.get("topic") is not None
if force_refresh and by:
logger.debug(f"🚨 Force refresh enabled for topic filter: {by.get('topic')}")
cached_result = await cached_query(cache_key, fetch_authors_with_stats, force_refresh=force_refresh)
logger.debug(f"Cached result: {cached_result}")
return cached_result