Skip to content
Snippets Groups Projects
Commit e3cacd9c authored by Abdallah Toumji's avatar Abdallah Toumji
Browse files

Ticket 1018 : Added a selector in the "saisie note" page to import notes from another evaluation

parent 479df931
No related branches found
No related tags found
No related merge requests found
...@@ -997,6 +997,63 @@ def _form_saisie_notes( ...@@ -997,6 +997,63 @@ def _form_saisie_notes(
method="GET", method="GET",
) )
H.append(tf.getform()) # check and init H.append(tf.getform()) # check and init
# Ticket 1018: Import notes from another evaluation
# Add a select element to import notes from another evaluation
# On selection change, the notes will be imported
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
evaluations = formsemestre.get_evaluations()
rows = {}
# Create a dictionary with the notes of each evaluation for each student
for e in evaluations:
notes = sco_evaluation_db.do_evaluation_get_all_notes(e.id)
for id, note in notes.items():
if e.id not in rows:
rows[e.id] = {}
rows[e.id][id] = note['value']
if len(evaluations) > 1:
H.append(
f'<select data-etudid="{etudid}" class="note_noteImporteur" onchange="set_import_eval(this, {rows})">'
)
# Add the default option "Sélectionner une évaluation à importer"
H.append('<option value="x" disabled selected>Sélectionner une évaluation à importer</option>')
for i in evaluations:
# Skip the current evaluation
if i.id == evaluation.id:
continue
# Add the others evaluations
H.append(f'<option value="{i.id}">{"todo titre module"} - {i.description}</option>')
H.append('</select>')
H.append("""<script>
window.onload = function() {
// Get the select element
const selectElement = document.querySelector('.note_noteImporteur');
// Reset the selection to the default option
if (selectElement) {
selectElement.value = ""; // This will select the "Sélectionner une évaluation à importer" option
}
}
</script>
""")
H.append(
f"""<button class="btn btn-primary" onclick="valid_import()" id="import_notes">Importer les notes</button>"""
)
else:
# Span if there is only one evaluation
H.append('<span class="noteImporteur">')
envir = "span"
item = "span"
H.append("</br>")
H.append("</br>")
H.append( H.append(
f"""<a href="{url_for("notes.moduleimpl_status", scodoc_dept=g.scodoc_dept, f"""<a href="{url_for("notes.moduleimpl_status", scodoc_dept=g.scodoc_dept,
moduleimpl_id=modimpl.id) moduleimpl_id=modimpl.id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment