As we started saving the secion-level data in cxc_corpora table, The document level data saved in cx_drafts table is redundant. But our translation draft restore mechanism relies on that table. We need a way to switch draft restore mechanism to corpora table . This should not affect any existing functionality at all too. I have the following rough idea:
- ApiQueryContentTranslation should check if there is a saved data for the given translation id in cxc_corpora table. If so access the data from there , aggregate the sections in their linear order and return it.
- If the data is not present in corpora table, check that in drafts table and fetch it.
- Whenever we save the data to corpora table, remove the entry from drafts table asynchronously(not blocking the request).
- Once the above steps are done stop saving the entire translation as part of autosave.
- Still there will be entries left in drafts table since there are translations kind of abandoned or not used recently. We will have to do some notification to translators and remove them after a defined time. (this can be a separate ticket, outside the scope of this ticket).
In effect, the autosave mechanism should become granular.