Browse Source

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

middleware_test
Kateřina Č 4 years ago
parent
commit
e1d563f00d
  1. 5
      .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. 13
      seminar/export.py
  8. 11
      seminar/models.py
  9. 2
      seminar/templates/seminar/archiv/cislo_vysledkovka.tex
  10. 8
      seminar/urls.py

5
.gitignore

@ -25,8 +25,11 @@ TODO
# .htpasswd kvůli přihlášení
.htpasswd
# .htpasswd pro AESOPa
/.htpasswd-aesop
# reversion kvůli historii objektů v reversion
**/reversion
# pro lidi, co programují v nástrojích od JetBrains
.idea
.idea

2
mamweb/settings_test.py

@ -67,3 +67,5 @@ LOGGING['loggers']['']['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_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>
</g>
</a>
<a
href="/aktualni/zadani/"
<a href="/static/images/graf/matematika.jpg"
id="temata"
transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)">
<g
@ -439,7 +438,7 @@
</g>
</a>
<a
href="/aktualni/zadani/"
href="/static/images/graf/fyzika.jpg"
id="a74"
transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)">
<g
@ -469,7 +468,7 @@
</g>
</a>
<a
href="/aktualni/zadani/"
href="/static/images/graf/informatika.jpg"
id="a80"
transform="matrix(0.70138313,0,0,0.7462289,-192.38886,20.298351)">
<g

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

13
seminar/export.py

@ -9,6 +9,7 @@ from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
from .ovvpfile import OvvpFile
from seminar import views
from seminar.views import vysledkovka
from seminar.utils import aktivniResitele
class ExportIndexView(generic.View):
@ -78,20 +79,24 @@ class ExportRocnikView(generic.View):
rocnik = get_object_or_404(Rocnik, prvni_rok=pr, exportovat=True)
cislo = rocnik.posledni_zverejnena_vysledkovka_cislo()
resitele = aktivniResitele(cislo, True)
slovnik_body = views.secti_body_za_rocnik(cislo, resitele)
_, setrizeni_resitele, setrizene_body = views.setrid_resitele_a_body(slovnik_body)
slovnik_body = vysledkovka.secti_body_za_rocnik(cislo, resitele, False)
setrizeni_resitele, body = vysledkovka.setrid_resitele_a_body(slovnik_body)
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.columns = ['id', 'name', 'surname', 'gender', 'born', 'email', 'end-year',
'street', 'town', 'postcode', 'country', 'spam-flag', 'spam-date',
'school', 'school-name', 'points', 'rank',]
resitele_slovnik = {}
for r in resitele:
resitele_slovnik[r.id] = r
# počítání pořadí řešitelů
posledni_body = 100000
posledni_poradi = 0
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]:
posledni_body = body[i]

11
seminar/models.py

@ -680,6 +680,17 @@ class Cislo(SeminarModelBase):
# Neexistující *Node nemá smysl aktualizovat.
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)
class Organizator(SeminarModelBase):
# 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}
\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
\hline
\endfoot

8
seminar/urls.py

@ -71,17 +71,17 @@ urlpatterns = [
# Aesop
path(
'aesop-export/mam-rocnik-<int:prvni_rok>.csv',
org_required(export.ExportRocnikView.as_view()),
export.ExportRocnikView.as_view(),
name='seminar_export_rocnik'
),
path(
'aesop-export/mam-sous-<str:datum_zacatku>.csv',
org_required(export.ExportSousView.as_view()),
export.ExportSousView.as_view(),
name='seminar_export_sous'
),
path(
'aesop-export/index.csv',
org_required(export.ExportIndexView.as_view()),
export.ExportIndexView.as_view(),
name='seminar_export_index'
),
@ -134,7 +134,9 @@ urlpatterns = [
path('prihlaska/',views.prihlaskaView, name='seminar_prihlaska'),
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('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/odevzdana_reseni/', resitel_required(views.PrehledOdevzdanychReseni.as_view()), name='seminar_resitel_odevzdana_reseni'),
path('reset-hesla/', views.PasswordResetView.as_view(), name='reset_password'),

Loading…
Cancel
Save