layout
This commit is contained in:
parent
0aa8961176
commit
a971043478
@ -1932,6 +1932,12 @@ def course_assessment(course_id):
|
|||||||
total_questions = len(questions)
|
total_questions = len(questions)
|
||||||
correct_answers = 0
|
correct_answers = 0
|
||||||
|
|
||||||
|
module_code = (course["code"] or "")[:1].upper()
|
||||||
|
module_was_completed_before = False
|
||||||
|
|
||||||
|
if module_code in ("A", "B", "C"):
|
||||||
|
module_was_completed_before = get_user_module_completion(session["user_id"], module_code) is not None
|
||||||
|
|
||||||
for q in questions:
|
for q in questions:
|
||||||
selected_answer_id = request.form.get(f"question_{q['id']}")
|
selected_answer_id = request.form.get(f"question_{q['id']}")
|
||||||
if not selected_answer_id:
|
if not selected_answer_id:
|
||||||
@ -1941,7 +1947,7 @@ def course_assessment(course_id):
|
|||||||
SELECT is_correct
|
SELECT is_correct
|
||||||
FROM answer
|
FROM answer
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
AND question_id = %s
|
AND question_id = %s
|
||||||
""", (int(selected_answer_id), q["id"]))
|
""", (int(selected_answer_id), q["id"]))
|
||||||
row = cur.fetchone()
|
row = cur.fetchone()
|
||||||
|
|
||||||
@ -1957,6 +1963,19 @@ def course_assessment(course_id):
|
|||||||
""", (session["user_id"], course_id, score, passed))
|
""", (session["user_id"], course_id, score, passed))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
module_completed_now = False
|
||||||
|
certificate_generated = False
|
||||||
|
|
||||||
|
if passed and module_code in ("A", "B", "C"):
|
||||||
|
module_is_completed_after = get_user_module_completion(session["user_id"], module_code) is not None
|
||||||
|
|
||||||
|
if module_is_completed_after and not module_was_completed_before:
|
||||||
|
certificate_result = generate_certificate_pdf_for_user(session["user_id"], module_code)
|
||||||
|
|
||||||
|
if certificate_result:
|
||||||
|
module_completed_now = True
|
||||||
|
certificate_generated = True
|
||||||
|
|
||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
@ -1968,6 +1987,9 @@ def course_assessment(course_id):
|
|||||||
score=score,
|
score=score,
|
||||||
total_questions=total_questions,
|
total_questions=total_questions,
|
||||||
passed=passed,
|
passed=passed,
|
||||||
|
module_completed_now=module_completed_now,
|
||||||
|
certificate_generated=certificate_generated,
|
||||||
|
module_code=module_code,
|
||||||
**get_current_user()
|
**get_current_user()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -278,4 +278,7 @@ def ensure_certificate_for_user_module(user_id, module_code):
|
|||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
return guid_value
|
return guid_value
|
||||||
|
|
||||||
|
def is_module_completed_for_user(user_id, module_code):
|
||||||
|
return get_user_module_completion(user_id, module_code) is not None
|
||||||
@ -12,7 +12,7 @@
|
|||||||
@bottom-center {
|
@bottom-center {
|
||||||
content: "Seite " counter(page) "/" counter(pages);
|
content: "Seite " counter(page) "/" counter(pages);
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
font-size: 10pt;
|
font-size: 9pt;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
font-size: 12.5pt;
|
font-size: 10pt;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 24pt;
|
font-size: 22pt;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #0d2f57;
|
color: #0d2f57;
|
||||||
margin-bottom: 10mm;
|
margin-bottom: 10mm;
|
||||||
@ -63,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.user-name {
|
.user-name {
|
||||||
font-size: 22pt;
|
font-size: 20pt;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #0d2f57;
|
color: #0d2f57;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -71,7 +71,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mandant-name {
|
.mandant-name {
|
||||||
font-size: 15pt;
|
font-size: 12pt;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 8mm;
|
margin-bottom: 8mm;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.program-name {
|
.program-name {
|
||||||
font-size: 18pt;
|
font-size: 16pt;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #0d2f57;
|
color: #0d2f57;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -138,7 +138,7 @@
|
|||||||
|
|
||||||
.footer-note {
|
.footer-note {
|
||||||
margin-top: 6mm;
|
margin-top: 6mm;
|
||||||
font-size: 10.5pt;
|
font-size: 9pt;
|
||||||
color: #526172;
|
color: #526172;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -196,8 +196,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="issuer">
|
<div class="issuer">
|
||||||
<strong>Ausgestellt durch:</strong><br>
|
<strong>Ausgestellt durch:</strong> ABC UG (haftungsbeschränkt)
|
||||||
ABC UG (haftungsbeschränkt)
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dates">
|
<div class="dates">
|
||||||
|
|||||||
@ -8,15 +8,24 @@
|
|||||||
<p><strong>Kurs:</strong> {{ course.code }} – {{ course.title }}</p>
|
<p><strong>Kurs:</strong> {{ course.code }} – {{ course.title }}</p>
|
||||||
<p><strong>Punkte:</strong> {{ score }} / {{ total_questions }}</p>
|
<p><strong>Punkte:</strong> {{ score }} / {{ total_questions }}</p>
|
||||||
|
|
||||||
{% if passed %}
|
{% if passed %}
|
||||||
<div class="success-box">
|
<div class="success-box">
|
||||||
Assessment bestanden.
|
Assessment bestanden.
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<div class="error-box">
|
{% if module_completed_now %}
|
||||||
Assessment nicht bestanden.
|
<div class="success-box" style="margin-top: 14px;">
|
||||||
</div>
|
Glückwunsch! Sie haben das Modul {{ module_code }} erfolgreich abgeschlossen.
|
||||||
{% endif %}
|
{% if certificate_generated %}
|
||||||
|
Ihr Zertifikat wurde automatisch erstellt und hinterlegt.
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<div class="error-box">
|
||||||
|
Assessment nicht bestanden.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="admin-actions">
|
<div class="admin-actions">
|
||||||
<a href="/courses" class="btn-primary">Zurück zu den Kursen</a>
|
<a href="/courses" class="btn-primary">Zurück zu den Kursen</a>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user