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; | ||||
| } | ||||
| 
 | ||||
| #obrazek_cisla_archiv { | ||||
| 	text-align: center; | ||||
| 	margin: 10px; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /* galerie */ | ||||
| 
 | ||||
|  |  | |||
|  | @ -921,7 +921,7 @@ class Tema(Problem): | |||
| 	tema_typ = models.CharField('Typ tématu', max_length=16, choices=TEMA_CHOICES,  | ||||
| 		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) | ||||
| 
 | ||||
| 	abstrakt = models.TextField('Abstrakt na rozcestník', blank=True) | ||||
|  |  | |||
|  | @ -9,11 +9,7 @@ | |||
|       Číslo {{ cislo }} | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h1> | ||||
| 
 | ||||
|   {% 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> | ||||
|   <a href='{{ cislo.rocnik.verejne_url }}'>Zpět na ročník {{ cislo.rocnik }}</a> | ||||
| 
 | ||||
|   {% if v_cisle_zadane %} | ||||
|     <h2>Zadané problémy</h2> | ||||
|  | @ -50,12 +46,26 @@ | |||
|       </div> | ||||
|   {% 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> | ||||
|   <div id="app"> | ||||
| 	  <app></app> | ||||
|   </div> | ||||
|   {% render_bundle 'chunk-vendors' %} | ||||
|   {% render_bundle 'vue_app_01' %} | ||||
| {% endcomment %} | ||||
| 
 | ||||
| 
 | ||||
|   {% if cislo.verejna_vysledkovka %} | ||||
|  | @ -74,7 +84,7 @@ | |||
|         <th class='border-r'># | ||||
|         <th class='border-r'>Jméno | ||||
|         {% 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 #} | ||||
|                 {% for podproblemy in podproblemy_iter.next %} | ||||
|  |  | |||
|  | @ -8,15 +8,17 @@ | |||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   {% if temata_v_rocniku %} | ||||
|   {% if rocnik.temata %} | ||||
|     <h2>Témata</h2> | ||||
|     <ul> | ||||
|     {% for tema in temata_v_rocniku %} | ||||
|       <li>{% if tema.text_zadani %}<a href="{{ tema.verejne_url }}">{% endif %}{{ tema.kod_v_rocniku }}: {{ tema.nazev }}{% if tema.text_zadani %}</a>{% endif %} | ||||
|     {% for tema in rocnik.temata.all %} | ||||
|       <li>{#<a href="{{ tema.verejne_url }}">#}{{ tema.nazev }}{#</a>#} | ||||
|     {% endfor %} | ||||
|     </ul> | ||||
|   {% endif %} | ||||
| 
 | ||||
| <h2>Čísla</h2> | ||||
| 
 | ||||
| <div class="cisla-v-rocniku"> | ||||
|   {% for c in rocnik.verejna_cisla %} | ||||
|     <div class="cislo_pole"> | ||||
|  | @ -61,6 +63,7 @@ | |||
|   {% endfor %} | ||||
| </div> | ||||
| 
 | ||||
| 
 | ||||
|   {% if vysledkovka %} | ||||
|     {% if user.je_org %} | ||||
|       <div class='mam-org-only'> | ||||
|  |  | |||
|  | @ -8,10 +8,10 @@ | |||
|   </h1> | ||||
| 
 | ||||
|   {% 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> | ||||
|     {% 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 %} | ||||
|     </ul> | ||||
|   {% endfor %} | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ | |||
| 	<hr> | ||||
| 
 | ||||
| 	{% 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 %} | ||||
| 
 | ||||
| 	{% if ac.pdf %} | ||||
|  |  | |||
|  | @ -581,7 +581,7 @@ def gen_temata(rnd, rocniky, rocnik_cisla, organizatori): | |||
| 		rocnik_temata.append(letosni_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. """ | ||||
| 	 | ||||
| 	# 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.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 | ||||
| 
 | ||||
| 
 | ||||
| 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...') | ||||
| 
 | ||||
| 	# 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. | ||||
| 				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) | ||||
| 
 | ||||
| 					insert_last_child(tema_node, uz) | ||||
|  | @ -860,7 +864,7 @@ def create_test_data(size = 6, rnd = None): | |||
| 		"MFI", 8) | ||||
| 
 | ||||
| 	# 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í | ||||
| 	soustredeni = gen_soustredeni(rnd, resitele, organizatori) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue