From 8af5c3ffa059e94504371ebca87e66c473674907 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 22 Mar 2023 21:57:40 +0100 Subject: [PATCH] Fix #621 --- app/static/js/saisie_notes.js | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/app/static/js/saisie_notes.js b/app/static/js/saisie_notes.js index 4dc782c9..0936b3d7 100644 --- a/app/static/js/saisie_notes.js +++ b/app/static/js/saisie_notes.js @@ -5,7 +5,7 @@ $().ready(function () { $("#formnotes .note").bind("blur", valid_note); $("#formnotes input").bind("paste", paste_text); - $(".btn_masquer_DEM").bind("click", masquer_DEM); + $(".btn_masquer_DEM").bind("click", masquer_DEM); }); @@ -16,7 +16,7 @@ function is_valid_note(v) { var note_min = parseFloat($("#eval_note_min").text()); var note_max = parseFloat($("#eval_note_max").text()); - if (!v.match("^-?[0-9.]*$")) { + if (!v.match("^-?[0-9]*.?[0-9]*$")) { return (v == "ABS") || (v == "EXC") || (v == "SUPR") || (v == "ATT") || (v == "DEM"); } else { var x = parseFloat(v); @@ -51,9 +51,9 @@ function save_note(elem, v, etudid) { 'comment': document.getElementById('formnotes_comment').value }, function (result) { - sco_message("enregistré"); - elem.className = "note_saved"; if (result['nbchanged'] > 0) { + sco_message("enregistré"); + elem.className = "note_saved"; // il y avait une decision de jury ? if (result.existing_decisions[0] == etudid) { if (v != $(elem).attr('data-orig-value')) { @@ -66,8 +66,12 @@ function save_note(elem, v, etudid) { if (result['history_menu']) { $("#hist_" + etudid).html(result['history_menu']); } + $(elem).attr('data-last-saved-value', v); + } else { + $('#sco_msg').html("").show(); + sco_message("valeur non enregistrée"); } - $(elem).attr('data-last-saved-value', v) + } ); } @@ -93,7 +97,7 @@ function paste_text(e) { var data = clipb.getData('Text'); var list = data.split(/\r\n|\r|\n|\t| /g); var currentInput = event.currentTarget; - var masquerDEM = document.querySelector("body").classList.contains("masquer_DEM"); + var masquerDEM = document.querySelector("body").classList.contains("masquer_DEM"); for (var i = 0; i < list.length; i++) { currentInput.value = list[i]; @@ -102,14 +106,14 @@ function paste_text(e) { currentInput.dispatchEvent(evt); var sibbling = currentInput.parentElement.parentElement.nextElementSibling; while ( - sibbling && - ( - sibbling.style.display == "none" || - ( - masquerDEM && sibbling.classList.contains("etud_dem") - ) - ) - ) { + sibbling && + ( + sibbling.style.display == "none" || + ( + masquerDEM && sibbling.classList.contains("etud_dem") + ) + ) + ) { sibbling = sibbling.nextElementSibling; } if (sibbling) { @@ -123,6 +127,6 @@ function paste_text(e) { } } -function masquer_DEM(){ - document.querySelector("body").classList.toggle("masquer_DEM"); +function masquer_DEM() { + document.querySelector("body").classList.toggle("masquer_DEM"); }