82a4c991ef
core_courseformat\external\get_state calls export_for_tempalte for each course module, which in turn calls completion_info::is_tracked_user() for the current user on the current course. The result of this call will be the same for every course module, so does not need to be called what may be several hundred times. This change allows the result of is_tracked_user to be passed to the cm state object, then calls it once and passes it to each cm's object. If it is not passed in, it will be computed on demand as before.