Merge branch 'data_migrations' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into data_migrations
This commit is contained in:
		
						commit
						f443a8cd2e
					
				
					 7 changed files with 39 additions and 17 deletions
				
			
		|  | @ -929,6 +929,11 @@ div.zadani_termin .datum { | ||||||
| 	margin:0px; | 	margin:0px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | #obrazek_cisla_archiv { | ||||||
|  | 	text-align: center; | ||||||
|  | 	margin: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| /* galerie */ | /* galerie */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -921,7 +921,7 @@ class Tema(Problem): | ||||||
| 	tema_typ = models.CharField('Typ tématu', max_length=16, choices=TEMA_CHOICES,  | 	tema_typ = models.CharField('Typ tématu', max_length=16, choices=TEMA_CHOICES,  | ||||||
| 		blank=False, default=TEMA_TEMA) | 		blank=False, default=TEMA_TEMA) | ||||||
| 
 | 
 | ||||||
| 	rocnik = models.ForeignKey(Rocnik, verbose_name='ročník',blank=True, null=True, | 	rocnik = models.ForeignKey(Rocnik, verbose_name='ročník',related_name='temata',blank=True, null=True, | ||||||
| 		on_delete=models.PROTECT) | 		on_delete=models.PROTECT) | ||||||
| 
 | 
 | ||||||
| 	abstrakt = models.TextField('Abstrakt na rozcestník', blank=True) | 	abstrakt = models.TextField('Abstrakt na rozcestník', blank=True) | ||||||
|  |  | ||||||
|  | @ -9,11 +9,7 @@ | ||||||
|       Číslo {{ cislo }} |       Číslo {{ cislo }} | ||||||
|     {% endblock %}{% endblock %} |     {% endblock %}{% endblock %} | ||||||
|   </h1> |   </h1> | ||||||
| 
 |   <a href='{{ cislo.rocnik.verejne_url }}'>Zpět na ročník {{ cislo.rocnik }}</a> | ||||||
|   {% if cislo.pdf %} |  | ||||||
|     <p><a href='{{ cislo.pdf.url }}'>Číslo v pdf</a> |  | ||||||
|   {% endif %} |  | ||||||
|   <p><a href='{{ cislo.rocnik.verejne_url }}'>Ročník {{ cislo.rocnik }}</a> |  | ||||||
| 
 | 
 | ||||||
|   {% if v_cisle_zadane %} |   {% if v_cisle_zadane %} | ||||||
|     <h2>Zadané problémy</h2> |     <h2>Zadané problémy</h2> | ||||||
|  | @ -50,12 +46,26 @@ | ||||||
|       </div> |       </div> | ||||||
|   {% endif %} |   {% endif %} | ||||||
| 
 | 
 | ||||||
|  |   <hr> | ||||||
|  | 
 | ||||||
|  |  <div id="obrazek_cisla_archiv"> | ||||||
|  |   {% if cislo.titulka_nahled %} | ||||||
|  | 		    <a href="{{ cislo.pdf.url }}"><img src="{{ cislo.titulka_nahled.url }}" alt=Titulní strana {{ cislo.poradi }}. čísla></a> | ||||||
|  |   {% elif cislo.pdf %} | ||||||
|  |     <a href='{{ cislo.pdf.url }}'>Číslo v pdf</a>    | ||||||
|  |   {% endif %} | ||||||
|  |   </div> | ||||||
|  | 
 | ||||||
|  |   <hr> | ||||||
|  | 
 | ||||||
|  | {% comment %} | ||||||
|   <script id="vuedata" type="application/json">{"treenode":{{cislo.cislonode.id}}}</script> |   <script id="vuedata" type="application/json">{"treenode":{{cislo.cislonode.id}}}</script> | ||||||
|   <div id="app"> |   <div id="app"> | ||||||
| 	  <app></app> | 	  <app></app> | ||||||
|   </div> |   </div> | ||||||
|   {% render_bundle 'chunk-vendors' %} |   {% render_bundle 'chunk-vendors' %} | ||||||
|   {% render_bundle 'vue_app_01' %} |   {% render_bundle 'vue_app_01' %} | ||||||
|  | {% endcomment %} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|   {% if cislo.verejna_vysledkovka %} |   {% if cislo.verejna_vysledkovka %} | ||||||
|  | @ -74,7 +84,7 @@ | ||||||
|         <th class='border-r'># |         <th class='border-r'># | ||||||
|         <th class='border-r'>Jméno |         <th class='border-r'>Jméno | ||||||
|         {% for p in problemy %} |         {% for p in problemy %} | ||||||
|         <th class='border-r' id="problem{{ p.kod_v_rocniku }}"><a href="{{ p.verejne_url }}">{{ p.kod_v_rocniku }}</a> |         <th class='border-r' id="problem{{ forloop.counter }}"><a href="{{ p.verejne_url }}">{{ p.kod_v_rocniku }}</a> | ||||||
| 
 | 
 | ||||||
|             {# TODELETE #} |             {# TODELETE #} | ||||||
|                 {% for podproblemy in podproblemy_iter.next %} |                 {% for podproblemy in podproblemy_iter.next %} | ||||||
|  |  | ||||||
|  | @ -8,15 +8,17 @@ | ||||||
|     {% endblock %}{% endblock %} |     {% endblock %}{% endblock %} | ||||||
|   </h2> |   </h2> | ||||||
| 
 | 
 | ||||||
|   {% if temata_v_rocniku %} |   {% if rocnik.temata %} | ||||||
|     <h2>Témata</h2> |     <h2>Témata</h2> | ||||||
|     <ul> |     <ul> | ||||||
|     {% for tema in temata_v_rocniku %} |     {% for tema in rocnik.temata.all %} | ||||||
|       <li>{% if tema.text_zadani %}<a href="{{ tema.verejne_url }}">{% endif %}{{ tema.kod_v_rocniku }}: {{ tema.nazev }}{% if tema.text_zadani %}</a>{% endif %} |       <li>{#<a href="{{ tema.verejne_url }}">#}{{ tema.nazev }}{#</a>#} | ||||||
|     {% endfor %} |     {% endfor %} | ||||||
|     </ul> |     </ul> | ||||||
|   {% endif %} |   {% endif %} | ||||||
| 
 | 
 | ||||||
|  | <h2>Čísla</h2> | ||||||
|  | 
 | ||||||
| <div class="cisla-v-rocniku"> | <div class="cisla-v-rocniku"> | ||||||
|   {% for c in rocnik.verejna_cisla %} |   {% for c in rocnik.verejna_cisla %} | ||||||
|     <div class="cislo_pole"> |     <div class="cislo_pole"> | ||||||
|  | @ -61,6 +63,7 @@ | ||||||
|   {% endfor %} |   {% endfor %} | ||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|   {% if vysledkovka %} |   {% if vysledkovka %} | ||||||
|     {% if user.je_org %} |     {% if user.je_org %} | ||||||
|       <div class='mam-org-only'> |       <div class='mam-org-only'> | ||||||
|  |  | ||||||
|  | @ -8,10 +8,10 @@ | ||||||
|   </h1> |   </h1> | ||||||
| 
 | 
 | ||||||
|   {% for rocnik, temata in rocniky.items %} |   {% for rocnik, temata in rocniky.items %} | ||||||
|     <h2>Ročník {{ rocnik }}</h2> |     <h2><a href="{{ rocnik.verejne_url }}">Ročník {{ rocnik }}</a></h2> | ||||||
|     <ul> |     <ul> | ||||||
|     {% for tema in temata %} |     {% for tema in temata %} | ||||||
|     <li><a href="{{ tema.verejne_url }}"> {{ tema.kod_v_rocniku }}: {{ tema.nazev }} </a></li> |     <li>{# <a href="{{ tema.verejne_url }}"> #}{{ tema.nazev }}{# </a> #}</li> | ||||||
|     {% endfor %} |     {% endfor %} | ||||||
|     </ul> |     </ul> | ||||||
|   {% endfor %} |   {% endfor %} | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ | ||||||
| 	<hr> | 	<hr> | ||||||
| 
 | 
 | ||||||
| 	{% if ac.titulka_nahled and ac.pdf %} | 	{% if ac.titulka_nahled and ac.pdf %} | ||||||
| 		<a href="{{ac.pdf.url}}"><img id="azad_obrazek" src="{{ac.titulka_nahled.url}}" alt=Titulní strana {{ac.poradi}}. čísla></img></a> | 		<a href="{{ac.pdf.url}}"><img id="azad_obrazek" src="{{ac.titulka_nahled.url}}" alt=Titulní strana {{ac.poradi}}. čísla></a> | ||||||
| 	{% endif %} | 	{% endif %} | ||||||
| 
 | 
 | ||||||
| 	{% if ac.pdf %} | 	{% if ac.pdf %} | ||||||
|  |  | ||||||
|  | @ -581,7 +581,7 @@ def gen_temata(rnd, rocniky, rocnik_cisla, organizatori): | ||||||
| 		rocnik_temata.append(letosni_temata) | 		rocnik_temata.append(letosni_temata) | ||||||
| 	return rocnik_temata | 	return rocnik_temata | ||||||
| 
 | 
 | ||||||
| def gen_ulohy_tematu(rnd, organizatori, tema, kod, cislo, cislo_se_vzorakem): | def gen_ulohy_tematu(rnd, organizatori, resitele, tema, kod, cislo, cislo_se_vzorakem): | ||||||
| 	""" Generování úlohy k danému tématu. """ | 	""" Generování úlohy k danému tématu. """ | ||||||
| 	 | 	 | ||||||
| 	# Proměnné pro náhodné generování názvů a zadání. | 	# Proměnné pro náhodné generování názvů a zadání. | ||||||
|  | @ -627,10 +627,14 @@ def gen_ulohy_tematu(rnd, organizatori, tema, kod, cislo, cislo_se_vzorakem): | ||||||
| 	uloha_zadani = UlohaZadaniNode.objects.create(uloha=uloha, first_child = zad, root=tema.temavcislenode_set.first().root) | 	uloha_zadani = UlohaZadaniNode.objects.create(uloha=uloha, first_child = zad, root=tema.temavcislenode_set.first().root) | ||||||
| 	uloha.ulohazadaninode = uloha_zadani | 	uloha.ulohazadaninode = uloha_zadani | ||||||
| 
 | 
 | ||||||
|  | 	# Generování řešení a hodnocení k úloze | ||||||
|  | 	gen_reseni_ulohy(rnd, [cislo], uloha, len(resitele)//4, 1, | ||||||
|  | 					 resitele, resitele) | ||||||
|  | 
 | ||||||
| 	return uloha, uloha_zadani | 	return uloha, uloha_zadani | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori): | def gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori, resitele): | ||||||
| 	logger.info('Generuji úlohy k tématům...') | 	logger.info('Generuji úlohy k tématům...') | ||||||
| 
 | 
 | ||||||
| 	# Ke každému ročníku si vezmeme příslušná čísla a témata | 	# Ke každému ročníku si vezmeme příslušná čísla a témata | ||||||
|  | @ -663,7 +667,7 @@ def gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori) | ||||||
| 					 | 					 | ||||||
| 				# Generujeme 1 až 4 úložky k tomuto témátku do tohoto čísla. | 				# Generujeme 1 až 4 úložky k tomuto témátku do tohoto čísla. | ||||||
| 				for kod in range(1, rnd.randint(1, 4)): | 				for kod in range(1, rnd.randint(1, 4)): | ||||||
| 					u, uz = gen_ulohy_tematu(rnd, organizatori, tema, kod,  | 					u, uz = gen_ulohy_tematu(rnd, organizatori, resitele, tema, kod, | ||||||
| 						cislo, cislo_se_vzorakem) | 						cislo, cislo_se_vzorakem) | ||||||
| 
 | 
 | ||||||
| 					insert_last_child(tema_node, uz) | 					insert_last_child(tema_node, uz) | ||||||
|  | @ -860,7 +864,7 @@ def create_test_data(size = 6, rnd = None): | ||||||
| 		"MFI", 8) | 		"MFI", 8) | ||||||
| 
 | 
 | ||||||
| 	# generování úloh k tématům ve všech číslech | 	# generování úloh k tématům ve všech číslech | ||||||
| 	gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori) | 	gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori, resitele) | ||||||
| 
 | 
 | ||||||
| 	#generování soustředění | 	#generování soustředění | ||||||
| 	soustredeni = gen_soustredeni(rnd, resitele, organizatori) | 	soustredeni = gen_soustredeni(rnd, resitele, organizatori) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue