Explorar el Código

Remove use of dates and fix totalscore result - refs BT#12404

Nicolas Ducoulombier hace 7 años
padre
commit
41ff883308
Se han modificado 1 ficheros con 13 adiciones y 4 borrados
  1. 13 4
      plugin/grading_electronic/generate.php

+ 13 - 4
plugin/grading_electronic/generate.php

@@ -99,12 +99,12 @@ try {
 
     /** @var \Category $gradebook */
     $gradebook = $cats[0];
-
     /** @var \ExerciseLink $exerciseLink */
+/** commented until we get clear understanding of how to use the dates refs BT#12404
     $exerciseLink = $gradebook->get_links()[0];
     $exerciseId = $exerciseLink->get_ref_id();
     $exerciseInfo = ExerciseLib::get_exercise_by_id($exerciseId, $course->getId());
-
+*/
     $dateStart = new DateTime($values['range_start'].' 00:00:00', new DateTimeZone('UTC'));
     $dateEnd = new DateTime($values['range_end'].' 23:59:59', new DateTimeZone('UTC'));
 
@@ -126,6 +126,7 @@ try {
         if (!$userFinishedCourse) {
              continue;
         }
+/** commented until we get clear understanding of how to use the dates refs BT#12404
         $exerciseResult = Event::get_best_exercise_results_by_user(
             $exerciseId,
             $course->getId(),
@@ -144,18 +145,26 @@ try {
         if (!$dateEnd) {
             continue;
         }
-
+*/
         $fieldStudent = $uFieldValue->get_values_by_handler_and_field_variable(
             $student->getId(),
             GradingElectronicPlugin::EXTRAFIELD_STUDENT_ID
         );
+        $scoretotal = $gradebook->calc_score($student->getId());
+        $scoredisplay = ScoreDisplay::instance();
+        $score = $scoredisplay->display_score(
+            $scoretotal,
+            SCORE_SIMPLE
+        );
+
+/** old method to get the score
 
         $score = Category::getCurrentScore(
             $student->getId(),
             $gradebook,
             true
         );
-
+*/
         $fileData[] = sprintf(
             "2 %sPASS%s %s %s",
             $fieldStudent ? $fieldStudent['value'] : null,