Pohádka otestována
This commit is contained in:
parent
9d7276578a
commit
34937391ff
1 changed files with 12 additions and 1 deletions
|
@ -254,12 +254,19 @@ def check_novinky():
|
||||||
|
|
||||||
def check_pohadka():
|
def check_pohadka():
|
||||||
old_query = "SELECT * FROM seminar_pohadky ORDER BY id"
|
old_query = "SELECT * FROM seminar_pohadky ORDER BY id"
|
||||||
new_query = """SELECT sp.id AS id, sp.autor_id AS autor_id, sp.vytvoreno AS vytvoreno, snp.treenode_ptr_id AS treenode_ptr_id, st.na_web AS text
|
new_query = """SELECT sp.id AS id, sp.autor_id AS autor_id, sp.vytvoreno AS vytvoreno, snp.treenode_ptr_id AS treenode_ptr_id, st.na_web AS text,
|
||||||
|
zn_pred.uloha_id AS uloha_pred, zn_po.uloha_id AS uloha_po
|
||||||
FROM seminar_pohadky AS sp
|
FROM seminar_pohadky AS sp
|
||||||
|
-- Text pohádky
|
||||||
INNER JOIN seminar_nodes_pohadka AS snp ON sp.id = snp.pohadka_id
|
INNER JOIN seminar_nodes_pohadka AS snp ON sp.id = snp.pohadka_id
|
||||||
INNER JOIN seminar_nodes_treenode AS snt ON snt.id = snp.treenode_ptr_id
|
INNER JOIN seminar_nodes_treenode AS snt ON snt.id = snp.treenode_ptr_id
|
||||||
INNER JOIN seminar_nodes_obsah AS sno ON sno.treenode_ptr_id = snt.first_child_id
|
INNER JOIN seminar_nodes_obsah AS sno ON sno.treenode_ptr_id = snt.first_child_id
|
||||||
INNER JOIN seminar_texty AS st ON sno.text_id = st.id
|
INNER JOIN seminar_texty AS st ON sno.text_id = st.id
|
||||||
|
-- Predchozí úloha
|
||||||
|
LEFT OUTER JOIN seminar_nodes_treenode AS ztn_pred ON ztn_pred.succ_id = snt.id
|
||||||
|
INNER JOIN seminar_nodes_uloha AS zn_pred ON zn_pred.treenode_ptr_id = ztn_pred.id
|
||||||
|
-- Následující úloha
|
||||||
|
LEFT OUTER JOIN seminar_nodes_uloha_zadani AS zn_po ON zn_po.treenode_ptr_id = snt.succ_id
|
||||||
|
|
||||||
ORDER BY sp.id"""
|
ORDER BY sp.id"""
|
||||||
|
|
||||||
|
@ -271,6 +278,10 @@ def check_pohadka():
|
||||||
if o['autor_id'] is not None:
|
if o['autor_id'] is not None:
|
||||||
if get_user_id_for_org_id(n['autor_id']) != o['autor_id']:
|
if get_user_id_for_org_id(n['autor_id']) != o['autor_id']:
|
||||||
raise ValueError("Nesedi autori u pohadky")
|
raise ValueError("Nesedi autori u pohadky")
|
||||||
|
# Správné úlohy
|
||||||
|
spravny_klic = 'uloha_pred' if o['pred'] else 'uloha_po'
|
||||||
|
if o['uloha_id'] != n[spravny_klic]:
|
||||||
|
raise ValueError(f"Pohádka přidružená ke špatné úloze! old: {o['uloha_id']}, new: {n[spravny_klic]}, pozice: {spravny_klic}")
|
||||||
|
|
||||||
|
|
||||||
# Problémy jsou rozdělené podle typů:
|
# Problémy jsou rozdělené podle typů:
|
||||||
|
|
Loading…
Reference in a new issue