Browse Source

Merge branch 'data_migrations' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into data_migrations

middleware_test
Kateřina Č 3 years ago
parent
commit
e1d563f00d
  1. 3
      .gitignore
  2. 2
      mamweb/settings_test.py
  3. BIN
      mamweb/static/images/graf/fyzika.JPG
  4. BIN
      mamweb/static/images/graf/informatika.jpg
  5. BIN
      mamweb/static/images/graf/matematika.jpg
  6. 7
      mamweb/templates/graph.svg
  7. 11
      seminar/export.py
  8. 11
      seminar/models.py
  9. 2
      seminar/templates/seminar/archiv/cislo_vysledkovka.tex
  10. 8
      seminar/urls.py

3
.gitignore

@ -25,6 +25,9 @@ TODO
# .htpasswd kvůli přihlášení # .htpasswd kvůli přihlášení
.htpasswd .htpasswd
# .htpasswd pro AESOPa
/.htpasswd-aesop
# reversion kvůli historii objektů v reversion # reversion kvůli historii objektů v reversion
**/reversion **/reversion

2
mamweb/settings_test.py

@ -67,3 +67,5 @@ LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins']
LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins']
LOGGING['handlers']['registration_logfile']['filename'] = '/home/mam-web/logs/test/registration.log' LOGGING['handlers']['registration_logfile']['filename'] = '/home/mam-web/logs/test/registration.log'
LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/test/registration_errors.log' LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/test/registration_errors.log'
FILE_UPLOAD_PERMISSIONS = 0o440

BIN
mamweb/static/images/graf/fyzika.JPG

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

BIN
mamweb/static/images/graf/informatika.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

BIN
mamweb/static/images/graf/matematika.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

7
mamweb/templates/graph.svg

@ -408,8 +408,7 @@
y="597.18036">Články</tspan></text> y="597.18036">Články</tspan></text>
</g> </g>
</a> </a>
<a <a href="/static/images/graf/matematika.jpg"
href="/aktualni/zadani/"
id="temata" id="temata"
transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)"> transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)">
<g <g
@ -439,7 +438,7 @@
</g> </g>
</a> </a>
<a <a
href="/aktualni/zadani/" href="/static/images/graf/fyzika.jpg"
id="a74" id="a74"
transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)"> transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)">
<g <g
@ -469,7 +468,7 @@
</g> </g>
</a> </a>
<a <a
href="/aktualni/zadani/" href="/static/images/graf/informatika.jpg"
id="a80" id="a80"
transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)"> transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)">
<g <g

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

11
seminar/export.py

@ -9,6 +9,7 @@ from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva #from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
from .ovvpfile import OvvpFile from .ovvpfile import OvvpFile
from seminar import views from seminar import views
from seminar.views import vysledkovka
from seminar.utils import aktivniResitele from seminar.utils import aktivniResitele
class ExportIndexView(generic.View): class ExportIndexView(generic.View):
@ -78,8 +79,8 @@ class ExportRocnikView(generic.View):
rocnik = get_object_or_404(Rocnik, prvni_rok=pr, exportovat=True) rocnik = get_object_or_404(Rocnik, prvni_rok=pr, exportovat=True)
cislo = rocnik.posledni_zverejnena_vysledkovka_cislo() cislo = rocnik.posledni_zverejnena_vysledkovka_cislo()
resitele = aktivniResitele(cislo, True) resitele = aktivniResitele(cislo, True)
slovnik_body = views.secti_body_za_rocnik(cislo, resitele) slovnik_body = vysledkovka.secti_body_za_rocnik(cislo, resitele, False)
_, setrizeni_resitele, setrizene_body = views.setrid_resitele_a_body(slovnik_body) setrizeni_resitele, body = vysledkovka.setrid_resitele_a_body(slovnik_body)
of = default_ovvpfile('MaM.rocnik', rocnik) of = default_ovvpfile('MaM.rocnik', rocnik)
of.headers['comment'] = u'MaM-Web export aktivnich resitelu rocniku {rocnik} do cisla {cislo}'.format(rocnik=rocnik, cislo=cislo) of.headers['comment'] = u'MaM-Web export aktivnich resitelu rocniku {rocnik} do cisla {cislo}'.format(rocnik=rocnik, cislo=cislo)
@ -87,11 +88,15 @@ class ExportRocnikView(generic.View):
'street', 'town', 'postcode', 'country', 'spam-flag', 'spam-date', 'street', 'town', 'postcode', 'country', 'spam-flag', 'spam-date',
'school', 'school-name', 'points', 'rank',] 'school', 'school-name', 'points', 'rank',]
resitele_slovnik = {}
for r in resitele:
resitele_slovnik[r.id] = r
# počítání pořadí řešitelů # počítání pořadí řešitelů
posledni_body = 100000 posledni_body = 100000
posledni_poradi = 0 posledni_poradi = 0
for i in range(len(setrizeni_resitele)): for i in range(len(setrizeni_resitele)):
rd = setrizeni_resitele[i].export_row() rd = resitele_slovnik[setrizeni_resitele[i]].export_row()
if posledni_body > body[i]: if posledni_body > body[i]:
posledni_body = body[i] posledni_body = body[i]

11
seminar/models.py

@ -680,6 +680,17 @@ class Cislo(SeminarModelBase):
# Neexistující *Node nemá smysl aktualizovat. # Neexistující *Node nemá smysl aktualizovat.
pass pass
def clean(self):
# Finální deadline má být až poslední a je povinný, pokud nějaký deadline existuje.
# Existence:
if self.datum_deadline is None and (self.datum_preddeadline is not None or self.datum_deadline_soustredeni is not None):
raise ValidationError({'datum_deadline': "Číslo musí mít finální deadline, pokud má nějaké deadliny"})
if self.datum_deadline is not None:
if self.datum_preddeadline is not None and self.datum_preddeadline > self.datum_deadline:
raise ValidationError({'datum_preddeadline': "Předdeadline musí předcházet finálnímu deadlinu"})
if self.datum_deadline_soustredeni is not None and self.datum_deadline_soustredeni > self.datum_deadline:
raise ValidationError({'datum_deadline_soustredeni': "Soustřeďkový deadline musí předcházet finálnímu deadlinu"})
@reversion.register(ignore_duplicates=True) @reversion.register(ignore_duplicates=True)
class Organizator(SeminarModelBase): class Organizator(SeminarModelBase):
# zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu # zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu

2
seminar/templates/seminar/archiv/cislo_vysledkovka.tex

@ -1,6 +1,6 @@
\setlength{\tabcolsep}{3pt} \setlength{\tabcolsep}{3pt}
\begin{longtable}{|r|l|c|r|{% for p in problemy %}c@{\hskip.5em}{% endfor %}|r|r|}\hline \begin{longtable}{|r|l|c|r|{% for p in problemy %}c@{\hskip.5em}{% endfor %}|r|r|}\hline
& & & & \multicolumn{ {{ problemy|length}} }{c|}{\textbf{Úlohy}} & & \\\textbf{Poř.}& \textbf{Jméno}& \textbf{R.}& \raisebox{0.7mm}{$\sum_{-1}$}& {% for p in problemy %}\textbf{ {{ p.kod_v_rocniku }} }&{% endfor %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline & & & & \multicolumn{ {{ problemy|length}} }{c|}{\textbf{Témata}} & & \\\textbf{Poř.}& \textbf{Jméno}& \textbf{R.}& \raisebox{0.7mm}{$\sum_{-1}$}& {% for p in problemy %}\textbf{ {{ p.kod_v_rocniku }} }&{% endfor %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline
\endhead \endhead
\hline \hline
\endfoot \endfoot

8
seminar/urls.py

@ -71,17 +71,17 @@ urlpatterns = [
# Aesop # Aesop
path( path(
'aesop-export/mam-rocnik-<int:prvni_rok>.csv', 'aesop-export/mam-rocnik-<int:prvni_rok>.csv',
org_required(export.ExportRocnikView.as_view()), export.ExportRocnikView.as_view(),
name='seminar_export_rocnik' name='seminar_export_rocnik'
), ),
path( path(
'aesop-export/mam-sous-<str:datum_zacatku>.csv', 'aesop-export/mam-sous-<str:datum_zacatku>.csv',
org_required(export.ExportSousView.as_view()), export.ExportSousView.as_view(),
name='seminar_export_sous' name='seminar_export_sous'
), ),
path( path(
'aesop-export/index.csv', 'aesop-export/index.csv',
org_required(export.ExportIndexView.as_view()), export.ExportIndexView.as_view(),
name='seminar_export_index' name='seminar_export_index'
), ),
@ -134,7 +134,9 @@ urlpatterns = [
path('prihlaska/',views.prihlaskaView, name='seminar_prihlaska'), path('prihlaska/',views.prihlaskaView, name='seminar_prihlaska'),
path('prihlasit/', views.LoginView.as_view(), name='login'), path('prihlasit/', views.LoginView.as_view(), name='login'),
path('login/', RedirectView.as_view(pattern_name='login', permanent=True, query_string=True)),
path('odhlasit/', views.LogoutView.as_view(), name='logout'), path('odhlasit/', views.LogoutView.as_view(), name='logout'),
path('logout/', RedirectView.as_view(pattern_name='login', permanent=True, query_string=True)),
path('resitel/', resitel_required(views.ResitelView.as_view()), name='seminar_resitel'), path('resitel/', resitel_required(views.ResitelView.as_view()), name='seminar_resitel'),
path('resitel/odevzdana_reseni/', resitel_required(views.PrehledOdevzdanychReseni.as_view()), name='seminar_resitel_odevzdana_reseni'), path('resitel/odevzdana_reseni/', resitel_required(views.PrehledOdevzdanychReseni.as_view()), name='seminar_resitel_odevzdana_reseni'),
path('reset-hesla/', views.PasswordResetView.as_view(), name='reset_password'), path('reset-hesla/', views.PasswordResetView.as_view(), name='reset_password'),

Loading…
Cancel
Save