Changing limit on the number of custom columns shown by the GUI

29 views
Skip to first unread message

Chip Maguire

unread,
Jun 5, 2017, 5:54:31 PM6/5/17
to Canvas LMS Users
As documented in https://community.canvaslms.com/thread/14978-changing-limit-on-the-number-of-custom-columns-shown-by-the-gui there is currently a limit of 10 custom columns that can be shown in the Canvas gradebook as the gradebook is not correctly handling pagination of API replies  (specifically, it does not handle paginated responses). [Note also that the doc/api/alive web page has the same problem - as it too does not properly handle paginated responses to the relevant API, while directly calling and handling the paginated responses from the API works correctly. Examples of python code using the API can be found at (for example): https://kth.instructure.com/courses/11/pages/exporting-gradebook?module_item_id=17416 ]

The source code file to change is ./lib/api.rb where it says:

def self.per_page
    Setting.get('api_per_page', '10').to_i
  end


change to 20 for example:


def self.per_page
    Setting.get('api_per_page', '20').to_i
  end


This solves the problem with respect to the gradebook as shown in the figure on the above web page (this was run in a local copy of the master code release from github with only the above 1 digit change and a change to a version requirement for an unrelated package due to a local compatibility issue). In addition, it will also half the number of API calls that need to be made in a number of places - since the amount of data returned per call of the API is twice as large.

I do not believe that an individual contributor agreement (ICA) is relevant here as there is clearly no IPR interest in whether the number is 10 or 20. In any case, I will disavow any IPR interest in the above-suggested change in the code.

Reards,
Gerald Q. "Chip" Maguire Jr.

Christopher Bennell

unread,
Jun 8, 2017, 4:00:57 PM6/8/17
to Canvas LMS Users
You might be better off calling 

Setting.set('api_per_page', '20')

from the console, rather than maintaining a change to the codebase.
Reply all
Reply to author
Forward
0 new messages