mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-25 07:42:05 +08:00
## Summary Consolidates two separate SQL queries into a single optimized query that returns translation progress along with aggregate counts. This reduces database round-trips from 2 to 1 per request. With the improved query performance, caching is no longer necessary, simplifying the codebase by removing cache management overhead. ## Changes - Modified `PostCandidates.completion_all_locales` to return aggregate counts (total and posts_with_detected_locale) in addition to per-locale translation progress - Updated controller to use single query method instead of two separate calls - Removed caching infrastructure (CACHE_TTL, cache key methods, cache clearing logic) - Updated tests to reflect new return format ## Performance Impact - **Before**: 2 SQL queries + 2 cache entries + cache invalidation logic - **After**: 1 optimized SQL query + no caching overhead ## Test Plan All existing tests pass: - `plugins/discourse-ai/spec/lib/translation/post_candidates_spec.rb` - `plugins/discourse-ai/spec/requests/admin/ai_translations_controller_spec.rb` |
||
|---|---|---|
| .. | ||
| ai_bot | ||
| ai_helper | ||
| ai_moderation | ||
| embeddings | ||
| llms | ||
| page_objects | ||
| summarization | ||
| admin_ai_features_spec.rb | ||
| admin_ai_persona_spec.rb | ||
| admin_ai_translations_spec.rb | ||
| admin_dashboard_spec.rb | ||
| ai_artifact_key_value_api_spec.rb | ||
| ai_usage_spec.rb | ||
| ai_user_preferences_spec.rb | ||
| core_features_spec.rb | ||