-
Couldn't load subscription status.
- Fork 8.7k
FIX: Completion rate double-count and normalize #33963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| private | ||
|
|
||
| total = get.count | ||
| def self.calculate_completion_per_locale(locale) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a bit of duplication here per-type but we can de-duplicate when we start finalising other models such as tags or localizing tables from other plugins such as post voting comments.
| def self.get_completion_per_locale(locale) | ||
| Discourse | ||
| .cache | ||
| .fetch(get_completion_cache_key(locale), expires_in: 1.hour) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would push this into a const, its a tough recipe to get right, potentially you want to manually expire the cache on certain events.
overall though ... this is super safe, cause at 1 hour the chances of any excessive work are very low.
This PR fixes 2 things. 1. If a `post` was written in `ja` (Japanese) and for some reason also had a `post_localization` that is `ja`, it becomes 200% 2. When getting completion progress for "English (US)", if there exists a "English (UK)" localization, we want to include that 3. Previously the completion count was also getting `post_localization` from posts that are not candidates. If the user switches `ai_translation_backfill_limit_to_public_content` from false to true, it would include previously localized PMs when it should not. Follow up: #33927
This PR fixes 2 things. 1. If a `post` was written in `ja` (Japanese) and for some reason also had a `post_localization` that is `ja`, it becomes 200% 2. When getting completion progress for "English (US)", if there exists a "English (UK)" localization, we want to include that 3. Previously the completion count was also getting `post_localization` from posts that are not candidates. If the user switches `ai_translation_backfill_limit_to_public_content` from false to true, it would include previously localized PMs when it should not. Follow up: #33927
This PR fixes 2 things.
postwas written inja(Japanese) and for some reason also had apost_localizationthat isja, it becomes 200%post_localizationfrom posts that are not candidates. If the user switchesai_translation_backfill_limit_to_public_contentfrom false to true, it would include previously localized PMs when it should not.Follow up: #33927