Skip to content

Conversation

@nattsw
Copy link
Contributor

@nattsw nattsw commented Apr 28, 2025

This PR corrects the logic in fetch_untranslated_model_ids to prevent posts/topics that already have a translation in the target locale from being returned for backfill. Previously, the SQL query only excluded posts where the detected locale and translation were both present for the target locale, resulting in posts with existing translations being included when their detected_locale was different.

Related: #255

@nattsw nattsw requested a review from Copilot April 28, 2025 09:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the logic in fetch_untranslated_model_ids so that posts with an existing translation in the target locale are correctly excluded, even if their detected locale differs.

  • Added a spec to validate that posts with target translations are not returned.
  • Simplified the SQL query in fetch_untranslated_model_ids to use two separate NOT IN clauses for excluding posts with a detected target locale or a translation in the target locale.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
spec/jobs/automatic_translation_backfill_spec.rb Added a new test ensuring posts with a target locale translation are excluded.
app/jobs/scheduled/automatic_translation_backfill.rb Refactored the SQL query to properly exclude posts with an existing target translation.

@nattsw nattsw merged commit 0f151b5 into main Apr 28, 2025
6 checks passed
@nattsw nattsw deleted the fix-backfill-except-clause branch April 28, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants