|
|
@ -38,7 +38,7 @@ def check_same(old_row, new_row, old_fields, new_fields=None): |
|
|
|
for old_field, new_field in fields: |
|
|
|
if old_row[old_field] == new_row[new_field]: |
|
|
|
continue |
|
|
|
raise ValueError(f"Fields '{old_field}' and '{new_field}' differs for rows '{old_row}' and '{new_row}'") |
|
|
|
raise ValueError(f"Fields '{old_field}' and '{new_field}' differs for rows \n'{old_row}' and \n'{new_row}'") |
|
|
|
return True |
|
|
|
|
|
|
|
def get_user_id_for_org_id(org_id): |
|
|
@ -233,6 +233,26 @@ def check_novinky(): |
|
|
|
if get_user_id_for_org_id(n['autor_id']) != o['autor_id']: |
|
|
|
raise ValueError("Nesedi autori u novinek") |
|
|
|
|
|
|
|
def check_pohadka(): |
|
|
|
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 |
|
|
|
FROM seminar_pohadky AS sp |
|
|
|
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_obsah AS sno ON sno.treenode_ptr_id = snt.first_child_id |
|
|
|
INNER JOIN seminar_texty AS st ON sno.text_id = st.id |
|
|
|
|
|
|
|
ORDER BY sp.id""" |
|
|
|
|
|
|
|
old_res, new_res = execute_simple(old_query,new_query) |
|
|
|
res = zip(old_res,new_res) |
|
|
|
|
|
|
|
for o,n in res: |
|
|
|
check_same(o,n,['id','timestamp','text'],['id','vytvoreno','text']) |
|
|
|
if o['autor_id'] is not None: |
|
|
|
if get_user_id_for_org_id(n['autor_id']) != o['autor_id']: |
|
|
|
raise ValueError("Nesedi autori u pohadky") |
|
|
|
|
|
|
|
|
|
|
|
# Problémy jsou rozdělené podle typů: |
|
|
|
def check_uloha(): |
|
|
@ -282,6 +302,7 @@ check_soustredeni_ucastnici() |
|
|
|
check_soustredeni_organizatori() |
|
|
|
check_nastaveni() |
|
|
|
check_novinky() |
|
|
|
check_pohadka() |
|
|
|
|
|
|
|
check_uloha() |
|
|
|
check_tema() |
|
|
|