Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84390

Assign summary table not rendering all rows on first visit

      During rendering of the assign submission summary table for students, there is the following code:

      https://github.com/moodle/moodle/blob/main/mod/assign/locallib.php#L5556

      $submissionstatus = $this->get_assign_submission_status_renderable($user, $showlinks);
      $o .= $this->get_renderer()->render($submissionstatus);
      

       

      In the get_assign_submission_status_renderable function, we get the user submission and later pass it to $submissionstatus which we then return from this function.

      https://github.com/moodle/moodle/blob/main/mod/assign/locallib.php#L5322

      public function get_assign_submission_status_renderable($user, $showlinks) {
        ...
        $submission = $this->get_user_submission($user->id, false);  
        ...      
        $gradingstatus = $this->get_grading_status($user->id);
       
        $submissionstatus = new assign_submission_status(<pass $submission>)
      }

       

      When a user is viewing this submission for the first time, $submission is empty. However, the entry in the assign_submission table is created in the get_user_grade function which is called from get_grading_status:

      https://github.com/moodle/moodle/blob/main/mod/assign/locallib.php#L3949

      public function get_user_grade($userid, $create, $attemptnumber=-1) { 
          $submission = $this->get_user_submission($userid, true, $attemptnumber);
      

       

      So we incorrectly pass an empty submission to $submissionstatus. The effect of this is that some rows of the table will only be rendered on the next page load.

       

            djarran Djarran Cotleanu
            djarran Djarran Cotleanu
            gbarat87 gbarat87
            Glyn (Mathew) May Glyn (Mathew) May
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.