Merge branch 'migrations_shuffle' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into migrations_shuffle
This commit is contained in:
		
						commit
						1c8fbd977f
					
				
					 1 changed files with 22 additions and 1 deletions
				
			
		|  | @ -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() | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky