Optimization of "not translated into" filter #690
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The query that is executed when users displayed sentences not translated into XXX contains a several joins.
We could do without these JOINs because we have the required fields already in the
sentences_translations
table, in thesentence_lang
andtranslation_lang
fields.For a comparison, on my machine, searching for
https://gist.github.com/trang/928652c1a56fd9b8bdb8
Now the problem when selecting from the
sentences_translations
table is that we need to make sure thesentence_lang
andtranslation_lang
fields are in sync with the language in thesentences
table.When a user changes the language of a sentence, it doesn't update the
sentences_translations
table accordingly. I didn't take care of this yet.I have only added a file containing the queries to fix the
sentences_translations
table but the last queries are really, really slow to execute. I don't know if there's a solution to make them faster, or if it's better to just retrieve the id's to delete and generate a script with a bunch ofDELETE FROM sentences_translations WHERE sentence_id = XXX
.So there are at least 2 things to do before this pull request can be merged:
sentences_translations
when the language of a sentence changes.sentences_translations
with the languages insentences
.