Browse Source

fix check_uloha

middleware_test
Pavel Turinsky (DebianVM @ Zr) 3 years ago
parent
commit
dfb00d6772
  1. 15
      db_compare.py

15
db_compare.py

@ -350,20 +350,21 @@ def check_problem_common():
def check_uloha(): def check_uloha():
old_query = "SELECT * FROM seminar_problemy WHERE typ = 'uloha' ORDER BY id" 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 FROM seminar_ulohy
-- Problém: -- Problém:
JOIN seminar_problemy AS problem ON problem_ptr_id = problem.id JOIN seminar_problemy AS problem ON problem_ptr_id = problem.id
-- Text zadání: -- 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_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_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 LEFT OUTER 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_texty AS uzt ON uzo.text_id = uzt.id
-- Text vzoráku: -- 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_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 LEFT OUTER 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_texty AS uvt ON uvo.text_id = uvt.id
ORDER BY problem_ptr_id""" ORDER BY problem_ptr_id"""
@ -381,7 +382,7 @@ def check_uloha():
for o,n in res: for o,n in res:
check_same(o,n, old_fields, new_fields) check_same(o,n, old_fields, new_fields)
# Datum deadline vypadá prázdně, tak to budeme předpokládat. # 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.") raise ValueError("Úloha má deadline.")
def check_tema(): def check_tema():

Loading…
Cancel
Save