EDS/EDE exam views differ in templated content not in ep/non-ep data

This commit is contained in:
Claude Paroz 2019-11-04 09:31:26 +01:00
parent c0fbfa6ec7
commit dc6bc6fa84
5 changed files with 19 additions and 60 deletions

View file

@ -110,7 +110,7 @@ class StudentAdmin(admin.ModelAdmin):
autocomplete_fields = ('corporation', 'instructor', 'supervisor', 'mentor', 'expert', 'expert_ep')
readonly_fields = (
'report_sem1_sent', 'report_sem2_sent',
'examination_ede_actions', 'examination_eds_actions',
'examination_actions',
'date_soutenance_mailed', 'date_soutenance_ep_mailed'
)
fieldsets = [
@ -134,8 +134,7 @@ class StudentAdmin(admin.ModelAdmin):
('training_referent', 'referent', 'mentor'),
('internal_expert', 'expert'),
('date_soutenance_mailed', 'date_confirm_received'),
('examination_ede_actions',),
('examination_eds_actions',),
('examination_actions',),
('mark', 'mark_acq'),
)
}),
@ -180,7 +179,7 @@ class StudentAdmin(admin.ModelAdmin):
student.save()
archive.short_description = "Marquer les étudiants sélectionnés comme archivés"
def examination_ede_actions(self, obj):
def examination_actions(self, obj):
if self.is_ede_3(obj):
if obj.missing_examination_data():
return mark_safe(
@ -196,12 +195,7 @@ class StudentAdmin(admin.ModelAdmin):
reverse('student-ede-convocation', args=[obj.pk]),
reverse('print-mentor-compens-ede', args=[obj.pk]),
)
else:
return ''
examination_ede_actions.short_description = 'Actions pour les examens EDE'
def examination_eds_actions(self, obj):
if self.is_eds_3(obj):
elif self.is_eds_3(obj):
if obj.missing_examination_data():
return mark_safe(
'<div class="warning">Veuillez compléter les informations '
@ -218,7 +212,7 @@ class StudentAdmin(admin.ModelAdmin):
)
else:
return ''
examination_eds_actions.short_description = 'Actions pour les examens EDS'
examination_actions.short_description = 'Actions pour les examens'
class CorpContactAdmin(admin.ModelAdmin):

View file

@ -534,14 +534,6 @@ class ExpertEdsLetterPdf(ExpertEdeLetterPdf):
La soutenance de ce travail de diplôme se déroulera le:<br/><br/>
"""
def exam_data(self):
return {
'expert': self.student.expert_ep,
'internal_expert': self.student.internal_expert_ep,
'date_exam': self.student.date_exam_ep,
'room': self.student.room_ep,
}
class MentorCompensationPdfForm(CompensationForm, EpcBaseDocTemplate):
def __init__(self, out, student):

View file

@ -281,15 +281,15 @@ tél. 032 886 33 00
"Lexpert interne nest pas défini"):
self.assertContains(response, err)
st.email = 'hots@example.org'
st.date_exam_ep = datetime(2018, 6, 28, 12, 00)
st.room_ep = "B123"
st.expert_ep = CorpContact.objects.get(last_name="Horner")
st.internal_expert_ep = Teacher.objects.get(last_name="Caux")
st.date_exam = datetime(2018, 6, 28, 12, 00)
st.room = "B123"
st.expert = CorpContact.objects.get(last_name="Horner")
st.internal_expert = Teacher.objects.get(last_name="Caux")
st.save()
response = self.client.get(url, follow=True)
self.assertContains(response, "Lexpert externe na pas de courriel valide !")
st.expert_ep.email = "horner@example.org"
st.expert_ep.save()
st.expert.email = "horner@example.org"
st.expert.save()
response = self.client.get(url)
expected_message = """ Laurent Hots,
Madame Julie Caux,
@ -324,7 +324,7 @@ tél. 032 886 33 00
})
self.assertEqual(len(mail.outbox), 1)
st.refresh_from_db()
self.assertIsNotNone(st.date_soutenance_ep_mailed)
self.assertIsNotNone(st.date_soutenance_mailed)
def test_print_ede_compensation_forms(self):
st = Student.objects.get(first_name="Albin")
@ -376,10 +376,10 @@ tél. 032 886 33 00
response = self.client.get(url, follow=True)
self.assertContains(response, "Toutes les informations ne sont pas disponibles")
st.expert_ep = CorpContact.objects.get(last_name="Horner")
st.internal_expert_ep = Teacher.objects.get(last_name="Caux")
st.date_exam_ep = datetime(2018, 6, 28, 12, 00)
st.room_ep = "B123"
st.expert = CorpContact.objects.get(last_name="Horner")
st.internal_expert = Teacher.objects.get(last_name="Caux")
st.date_exam = datetime(2018, 6, 28, 12, 00)
st.room = "B123"
st.save()
response = self.client.get(url, follow=True)
@ -390,7 +390,7 @@ tél. 032 886 33 00
self.assertEqual(response['Content-Type'], 'application/pdf')
self.assertGreater(int(response['Content-Length']), 1000)
# Expert without corporation
st.expert_ep = CorpContact.objects.create(first_name='James', last_name='Bond')
st.expert = CorpContact.objects.create(first_name='James', last_name='Bond')
st.save()
response = self.client.get(url, follow=True)
self.assertEqual(response.status_code, 200)

View file

@ -492,33 +492,6 @@ class StudentConvocationEDSView(StudentConvocationExaminationView):
title = "Convocation à la soutenance du travail final"
email_template = 'email/student_convocation_EDS.txt'
@property
def expert(self):
return self.student.expert_ep
@property
def internal_expert(self):
return self.student.internal_expert_ep
@property
def date_soutenance_mailed(self):
return self.student.date_soutenance_ep_mailed
def missing_examination_data(self):
return self.student.missing_examination_ep_data()
def msg_context(self):
context = super().msg_context()
context.update({
'date_examen': django_format(self.student.date_exam_ep, 'l j F Y à H\hi'),
'salle': self.student.room_ep,
})
return context
def on_success(self, student):
self.student.date_soutenance_ep_mailed = timezone.now()
self.student.save()
class PrintUpdateForm(ZippedFilesBaseView):
"""
@ -603,7 +576,7 @@ class PrintExpertEDSCompensationForm(PrintExpertEDECompensationForm):
pdf_class = ExpertEdsLetterPdf
def check_object(self, student):
missing = student.missing_examination_ep_data()
missing = student.missing_examination_data()
if missing:
messages.error(self.request, "\n".join(
["Toutes les informations ne sont pas disponibles pour la lettre à lexpert!"]

View file

@ -8,7 +8,7 @@ Nous vous informons que la soutenance du travail final de {{ student.civility_fu
- {{ date_examen }} en salle {{ salle }}
Nous informons également {{ student.expert_ep.civility }} {{ student.expert_ep.last_name }} que le mémoire lui est adressé ce jour par courrier postal.
Nous informons également {{ student.expert.civility }} {{ student.expert.last_name }} que le mémoire lui est adressé ce jour par courrier postal.
Nous vous remercions de nous confirmer par retour de courriel que vous avez bien reçu ce message et dans lattente du plaisir de vous rencontrer prochainement, nous vous prions dagréer, {{ global_civilities }}, nos salutations les meilleures.