From 6c71f050d0d25693ca949ba11bbfbf1a1d11f271 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 2 Jun 2021 02:59:27 +0200 Subject: [PATCH] =?UTF-8?q?T=C3=A9ma=20->=20ro=C4=8Dn=C3=ADk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db_compare.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/db_compare.py b/db_compare.py index a2775e9c..683e2037 100644 --- a/db_compare.py +++ b/db_compare.py @@ -325,24 +325,31 @@ def check_uloha(): raise ValueError("Úloha má deadline.") def check_tema(): - old_query = "SELECT * FROM seminar_problemy WHERE typ IN ('tema', 'serial') ORDER BY id" - new_query = """SELECT tema_typ, zad_text.na_web AS text_zadani, res_text.na_web AS text_reseni + old_query = """SELECT text_zadani, text_reseni, typ, c.rocnik_id AS rocnik_id + FROM seminar_problemy + INNER JOIN seminar_cisla as c ON c.id = cislo_zadani_id + WHERE typ IN ('tema', 'serial') + ORDER BY 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 FROM seminar_temata -- Problém: JOIN seminar_problemy AS problem ON problem_ptr_id = problem.id -- Text: -- 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 roottn ON tvcn.treenode_ptr_id = roottn.id - INNER JOIN seminar_nodes_treenode AS zad_tn ON roottn.first_child_id = zad_tn.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 + -- Ročník tématu: + -- Podle rootu TvCN + INNER JOIN seminar_nodes_rocnik AS rn ON ttn.root_id = rn.treenode_ptr_id ORDER BY problem_ptr_id""" - same_fields = ['text_zadani', 'text_reseni'] + same_fields = ['text_zadani', 'text_reseni', 'rocnik_id'] renamed_fields = [ ('typ', 'tema_typ'), ] @@ -354,7 +361,6 @@ def check_tema(): for o,n in res: check_same(o,n, old_fields, new_fields) - #TODO: Tema.rocnik def check_konfera(): old_query = "SELECT * FROM seminar_problemy WHERE typ = 'konfera'"