participants not being listed due to tablesort

participants not being listed due to tablesort

by Michael Lynn -
Number of replies: 0

I have tried to raise this as a Moodle Tracker issue but I get the stern message:

Dear Moodler, before creating a new issue you need to demonstrate that you have searched among the existing issues to see if it's already been filed. Please find a similar issue from among the open issues and either start watching it or vote for it.

Well, I have searched and it ain't there so I'll have to ask the community. Moodle Tracker wouldn't allow me to post this message.


We have a custom grade book for our customer which allows them to click through from the grade to the assignment in mod/assign to allow them to grade or update grade details in mod/assign more easily. This worked in Moodle 3.5. We are currently testing an upgrade to Moodle 3.7.2+

 

When the user clicks through we get the error "No student selected" in the top panel of mod/assign and the assignment is not showing. I see the new built-in gradebook does not allow this click through action, 

The web service request for ListParticipants now contains the attribute sortable:true

The affected method is in: mod/assign/locallib.php
 

if ($tablesort) {
// Resort the user list according to the grading table sort and filter settings.
$sortedfiltereduserids = $this->get_grading_userid_list(true, '');   

This method attempts to retrieve the data from the cache but if the user hasn't been in mod/assign and is viewing the gradebook the session variable will not have been populated.
 

protected function get_grading_userid_list($cached = false, $useridlistid = '') {
 if ($cached) { 
   if (empty($useridlistid)) { 
     $useridlistid = $this->get_useridlist_key_id(); 
   } 
   $useridlistkey = $this->get_useridlist_key($useridlistid); 
   if (empty($SESSION->mod_assign_useridlist[$useridlistkey])) { 
     $SESSION->mod_assign_useridlist[$useridlistkey] = $this->get_grading_userid_list(false, '');
    } 
    return $SESSION->mod_assign_useridlist[$useridlistkey]; 
  } 

  $filter = get_user_preferences('assign_filter', ''); 
  $table = new assign_grading_table($this, 0, $filter, 0, false); 
  $useridlist = $table->get_column_data('userid');
  return $useridlist; 
}


This is a nasty recursive function but again if the user hasn't been in mod assign before it might not have all the information to retrieve the user list. Since this could be called via a web service would 2 sets of results be returned? First with data, second without because it's recursive?
 
In order to workaround this and short circuit this we have set $tablesort = false; in list_participants() in locallib.php to make it work like Moodle 3.5 at the moment.


Average of ratings: -