mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 20:54:27 +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` |
||
|---|---|---|
| .. | ||
| controllers | ||
| helpers/discourse_ai/ai_bot | ||
| jobs | ||
| mailers | ||
| models | ||
| serializers | ||
| services | ||
| views | ||