|
|
@ -390,7 +390,7 @@ def check_tema(): |
|
|
|
LEFT OUTER JOIN seminar_cisla AS c ON c.id = cislo_zadani_id |
|
|
|
WHERE typ IN ('tema', 'serial') |
|
|
|
ORDER BY seminar_problemy.id""" |
|
|
|
new_query = """SELECT tema_typ, zad_text.na_web AS text_zadani, res_text.na_web AS text_reseni, rn.rocnik_id AS rocnik_id |
|
|
|
new_query = """SELECT tema_typ, COALESCE(zad_text.na_web, '') AS text_zadani, COALESCE(res_text.na_web, '') AS text_reseni, rn.rocnik_id AS rocnik_id |
|
|
|
FROM seminar_temata |
|
|
|
-- Problém: |
|
|
|
JOIN seminar_problemy AS problem ON problem_ptr_id = problem.id |
|
|
@ -398,15 +398,15 @@ def check_tema(): |
|
|
|
-- TvCNode má dva potomky, oba TextNode. První drží původní text zadání, druhý řešení. |
|
|
|
INNER JOIN seminar_nodes_temavcisle AS tvcn ON tvcn.tema_id = id |
|
|
|
INNER JOIN seminar_nodes_treenode AS ttn ON tvcn.treenode_ptr_id = ttn.id |
|
|
|
INNER JOIN seminar_nodes_treenode AS zad_tn ON ttn.first_child_id = zad_tn.id |
|
|
|
INNER JOIN seminar_nodes_treenode AS res_tn ON zad_tn.succ_id = res_tn.id |
|
|
|
INNER JOIN seminar_nodes_obsah AS zad_on ON zad_on.treenode_ptr_id = zad_tn.id |
|
|
|
INNER JOIN seminar_nodes_obsah AS res_on ON res_on.treenode_ptr_id = res_tn.id |
|
|
|
INNER JOIN seminar_texty AS zad_text ON zad_on.text_id = zad_text.id |
|
|
|
INNER JOIN seminar_texty AS res_text ON res_on.text_id = res_text.id |
|
|
|
LEFT OUTER JOIN seminar_nodes_treenode AS zad_tn ON ttn.first_child_id = zad_tn.id -- jen 33 z nich |
|
|
|
LEFT OUTER JOIN seminar_nodes_treenode AS res_tn ON zad_tn.succ_id = res_tn.id -- jen 4 z nich |
|
|
|
LEFT OUTER JOIN seminar_nodes_obsah AS zad_on ON zad_on.treenode_ptr_id = zad_tn.id |
|
|
|
LEFT OUTER JOIN seminar_nodes_obsah AS res_on ON res_on.treenode_ptr_id = res_tn.id |
|
|
|
LEFT OUTER JOIN seminar_texty AS zad_text ON zad_on.text_id = zad_text.id |
|
|
|
LEFT OUTER JOIN seminar_texty AS res_text ON res_on.text_id = res_text.id -- vsechny 4 |
|
|
|
-- Ročník tématu: |
|
|
|
-- Podle rootu TvCN |
|
|
|
INNER JOIN seminar_nodes_rocnik AS rn ON ttn.root_id = rn.treenode_ptr_id |
|
|
|
LEFT OUTER JOIN seminar_nodes_rocnik AS rn ON ttn.root_id = rn.treenode_ptr_id -- nic |
|
|
|
|
|
|
|
ORDER BY problem_ptr_id""" |
|
|
|
same_fields = ['text_zadani', 'text_reseni', 'rocnik_id'] |
|
|
|