Skip to content

Commit

Permalink
Fix #895
Browse files Browse the repository at this point in the history
  • Loading branch information
axel584 committed Jun 23, 2019
1 parent ef5b4ec commit d63c2d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions js/ikurso.js
Expand Up @@ -148,16 +148,22 @@ $('#eniri_identigilo,#eniri_pasvorto').keyup(function(e) {
}
});

// fonction pour les exercices dont la réponse est en base : on souligne en vert si on a la bonen réponse
// fonction pour les exercices dont la réponse est en base : on souligne en vert si on a la bonne réponse
$(".korektebla").focusout( function () {
$ekzercero = $(this).data('ekzercero');
$studanto = $(this).data('studanto');
console.log("korektebla : "+$(this).val());
$formulaire = $(this);
if ($formulaire.val()=="?") {
$respondo=""; // correction #895
} else {
$respondo = $formulaire.val();
}
$.ajax({
url : $cheminAbsolu+'ajax/memkorektado.php',
type : 'GET',
dataType : 'json',
data : "ekzercero="+$ekzercero+"&studanto="+$studanto+"&respondo="+$(this).val(),
data : "ekzercero="+$ekzercero+"&studanto="+$studanto+"&respondo="+$respondo,
success : function(reponse, statut){
if (reponse.mesagxo=="ok") {
$formulaire.addClass("valid");
Expand Down
2 changes: 1 addition & 1 deletion util.php
Expand Up @@ -71,7 +71,7 @@ function kontroliRespondon($lernantaRespondo,$bonaRespondo) {
// on n'utilise plus les expressions régulières car y'a des bugs et en plus, on aimerait trouver "de quelle réponse l'élève était le plus proche"
//return preg_match("/^".normaligita($bonaRespondo)."$/",normaligita($lernantaRespondo));
// attention, il ne faut pas utiliser != mais !==
echo '[Memory:'.memory_get_usage().'@'.__FILE__.':'.__LINE__.']';
//echo '[Memory:'.memory_get_usage().'@'.__FILE__.':'.__LINE__.']';
if (strpos($bonaRespondo,"|")!==false) {
return kontroliRespondon($lernantaRespondo,substr($bonaRespondo, 0,strpos($bonaRespondo, "|"))) || kontroliRespondon($lernantaRespondo,substr($bonaRespondo, strpos($bonaRespondo, "|")+1));
} else {
Expand Down

0 comments on commit d63c2d5

Please sign in to comment.