From dfb00d6772828010372895e081c2cdce0aa99c8e Mon Sep 17 00:00:00 2001 From: "Pavel Turinsky (DebianVM @ Zr)" Date: Tue, 29 Jun 2021 19:46:51 +0000 Subject: [PATCH] fix check_uloha --- db_compare.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/db_compare.py b/db_compare.py index 783b8124..02e01f63 100755 --- a/db_compare.py +++ b/db_compare.py @@ -350,20 +350,21 @@ def check_problem_common(): def check_uloha(): old_query = "SELECT * FROM seminar_problemy WHERE typ = 'uloha' ORDER BY id" - new_query = """SELECT cislo_zadani_id, cislo_reseni_id, problem_ptr_id, max_body, uzt.na_web AS text_zadani, uvt.na_web AS text_reseni + new_query = """SELECT cislo_zadani_id, cislo_reseni_id, problem_ptr_id, max_body, COALESCE(uzt.na_web, '') AS text_zadani, COALESCE(uvt.na_web, '') AS text_reseni, cislo_deadline_id FROM seminar_ulohy -- Problém: JOIN seminar_problemy AS problem ON problem_ptr_id = problem.id -- Text zadání: + -- ZadaniNode a VzorakNode maji existovat vzdy, ale obsah nemusi (pokud ho nemaji) INNER JOIN seminar_nodes_uloha_zadani AS uzn ON problem.id = uzn.uloha_id INNER JOIN seminar_nodes_treenode AS uztn ON uztn.id = uzn.treenode_ptr_id - INNER JOIN seminar_nodes_obsah AS uzo ON uzo.treenode_ptr_id = uztn.first_child_id - INNER JOIN seminar_texty AS uzt ON uzo.text_id = uzt.id + LEFT OUTER JOIN seminar_nodes_obsah AS uzo ON uzo.treenode_ptr_id = uztn.first_child_id + LEFT OUTER JOIN seminar_texty AS uzt ON uzo.text_id = uzt.id -- Text vzoráku: - INNER JOIN seminar_nodes_uloha_zadani AS uvn ON problem.id = uvn.uloha_id + INNER JOIN seminar_nodes_uloha_vzorak AS uvn ON problem.id = uvn.uloha_id INNER JOIN seminar_nodes_treenode AS uvtn ON uvtn.id = uvn.treenode_ptr_id - INNER JOIN seminar_nodes_obsah AS uvo ON uvo.treenode_ptr_id = uvtn.first_child_id - INNER JOIN seminar_texty AS uvt ON uvo.text_id = uvt.id + LEFT OUTER JOIN seminar_nodes_obsah AS uvo ON uvo.treenode_ptr_id = uvtn.first_child_id + LEFT OUTER JOIN seminar_texty AS uvt ON uvo.text_id = uvt.id ORDER BY problem_ptr_id""" @@ -381,7 +382,7 @@ def check_uloha(): for o,n in res: check_same(o,n, old_fields, new_fields) # Datum deadline vypadá prázdně, tak to budeme předpokládat. - if n['datum_deadline'] is not None: + if n['cislo_deadline_id'] is not None: raise ValueError("Úloha má deadline.") def check_tema():