Browse Source

Improve register float type to grades in submission

Igor 4 years ago
parent
commit
a7c8480adc
2 changed files with 6 additions and 3 deletions
  1. 2 0
      ilm_handlers/html5.php
  2. 4 3
      locallib.php

+ 2 - 0
ilm_handlers/html5.php

@@ -277,6 +277,7 @@ class html5 implements ilm_handle {
     else {
       document.formEnvio.iLM_PARAM_ArchiveContent.value = strAnswer;
       document.formEnvio.iLM_PARAM_ActivityEvaluation.value = evaluationResult;
+      document.formEnvio.iLM_PARAM_RealGrade.value = evaluation;
       //D alert(strAnswer);
       document.formEnvio.submit();
       return true; // success
@@ -306,6 +307,7 @@ class html5 implements ilm_handle {
     if (!isguestuser() && $iassign_statement_activity_item->type_iassign != 1) {
       $iassign .= " <input type='hidden' name='iLM_PARAM_ArchiveContent' value=''>\n";
       $iassign .= " <input type='hidden' name='iLM_PARAM_ActivityEvaluation' value=''>\n";
+      $iassign .= " <input type='hidden' name='iLM_PARAM_RealGrade' value=''>\n";
 
       if (!has_capability('mod/iassign:evaluateiassign', $USER->context, $USER->id))
         $iassign .= "<p><textarea rows='2' cols='60' name='submission_comment'></textarea></p>\n";

+ 4 - 3
locallib.php

@@ -463,6 +463,7 @@ class iassign {
 
     // receives post and get
     $iLM_PARAM_ActivityEvaluation = optional_param('iLM_PARAM_ActivityEvaluation', 0, PARAM_INT); // 1 - activity evaluated as correct / 0 - activity evaluated as incorrect
+    $iLM_PARAM_RealGrade = optional_param('iLM_PARAM_RealGrade', 0, PARAM_FLOAT);
     //2016/02/16: IMPORTANTE trocar formatador para "nao formatado", pois esta destruindo o conteudo do arquivo
     $iLM_PARAM_ArchiveContent = optional_param('iLM_PARAM_ArchiveContent', NULL, PARAM_RAW); // answer file (ATTENTION: do not change format, use RAW in order to ensure the correct content)
     $MA_POST_Info = optional_param('MA_POST_Info', NULL, PARAM_FORMAT);
@@ -509,7 +510,7 @@ class iassign {
           $this->write_solution = 1; // 
 
           $status = 3;
-          $grade_student = $this->activity->get_activity()->grade; // evaluated as correct solution submitted is assigned the note pattern of activity
+          $grade_student = $iLM_PARAM_RealGrade; // evaluated as correct solution submitted is assigned the note pattern of activity
           $msg = '<tr><td colspan=2>' . iassign_icons::insert('feedback_correct') . '<br>' . get_string('get_answer_correct', 'iassign') . '</td>';
 
           // log record
@@ -525,7 +526,7 @@ class iassign {
         } else { // else if (intval($iLM_PARAM_ActivityEvaluation) == 1)
           // Wrong answer...: get_answer_incorrect
           $status = 2;
-          $grade_student = 0; // evaluated as incorrect solution
+          $grade_student = $iLM_PARAM_RealGrade; // evaluated as incorrect solution
           $msg = '<tr><td colspan=2>' . iassign_icons::insert('feedback_incorrect') . '<br>' . get_string('get_answer_incorrect', 'iassign') . '</td>';
 
           // log record
@@ -563,7 +564,7 @@ class iassign {
           }
       } else { // if ($iassign_ilm->evaluate == 1 && $this->activity->get_activity()->automatic_evaluate == 1)
         $status = 1;
-        $grade_student = 0; // iLM not have automatic evaluator
+        $grade_student = $iLM_PARAM_RealGrade; // iLM not have automatic evaluator
 
         print '<tr><td colspan=2>' . iassign_icons::insert('post') . get_string('get_answer_post', 'iassign') . '</td>';
         print '<tr><td width=40% align=right>' . $return_last . '&nbsp;' . $link_return . '</td></tr>';