Closed vmonakhov closed 7 months ago
Now translationgists for perspectives are created with right gist_type. After the deleted gists were restored, the problem is resolved.
Tested, can be closed.
Translationgist query with better translation grouping:
with tg_cte as (
select translationgist.client_id, translationgist.object_id
from translationgist
left join dictionaryperspective on
translationgist.client_id=dictionaryperspective.translation_gist_client_id and
translationgist.object_id=dictionaryperspective.translation_gist_object_id and
dictionaryperspective.marked_for_deletion='false'
left join dictionary on
translationgist.client_id=dictionary.translation_gist_client_id and
translationgist.object_id=dictionary.translation_gist_object_id and
dictionary.marked_for_deletion='false'
where translationgist.marked_for_deletion='true' and
(dictionary.translation_gist_client_id is not NULL or
dictionaryperspective.translation_gist_client_id is not NULL)
group by translationgist.client_id, translationgist.object_id)
select tg_cte.client_id, tg_cte.object_id, array_agg(translationatom.content)
from tg_cte
join translationatom on
tg_cte.client_id=translationatom.parent_client_id and
tg_cte.object_id=translationatom.parent_object_id
group by tg_cte.client_id, tg_cte.object_id;
Result before undeletion fix:
client_id | object_id | array_agg
-----------+-----------+------------------------------------------------------------------------------------------------
1 | 26 | {Paradigms,Paradigmat,Парадигмы}
1 | 159 | {"Лексические входы","Leksikaalinen Merkinnät","Lexical Entries"}
66 | 2043 | {Морфология,Morphology}
66 | 2045 | {"Morphological Paradigms"}
425 | 2 | {"Словарь волжского диалекта марийского языка","Dictionary of Volga dialect of Mari language"}
(5 rows)
Fixing Service -> Perspective gist type for Morphology perspective translations:
select * from translationgist where client_id = 66 and object_id in (2043, 2045);
update translationgist set type = 'Perspective' where client_id = 66 and object_id in (2043, 2045);
Some perspectives have lost their names and even can't be opened from /dictionaries_all. This happened due to not correct type of translationgists related to the perspectives. So those translationgists have 'Service' type instead of 'Perspective' and were deleted together with perspective itself but other eponymous perspectives became unnamed.
The task is mainly described in https://github.com/ispras/lingvodoc-react/issues/788
An SQL query to get ids of translationgists to be restored:
An API was created to undelete translationgist with related translationatoms by the gist's id. User must have "delete translations" permissions for calling this API.
Request example (bash script with args: ):