MDL-70959 completion: Documentation improvements

* Fix typo in $cm parameter's type in PHPDoc
* Improve the comment to better explain the logic why fetching the
completion data for the whole course can only be done when caching is
used.
Even if $wholecourse is set to true, there's no point in fetching the
completion data for all the course modules unless we're caching the
results.
This commit is contained in:
Jun Pataleta
2021-03-19 11:52:23 +08:00
parent 8ee6f49384
commit 4e75827d72
+4 -2
View File
@@ -927,7 +927,7 @@ class completion_info {
* Obtains completion data for a particular activity and user (from the
* completion cache if available, or by SQL query)
*
* @param stcClass|cm_info $cm Activity; only required field is ->id
* @param stdClass|cm_info $cm Activity; only required field is ->id
* @param bool $wholecourse If true (default false) then, when necessary to
* fill the cache, retrieves information from the entire course not just for
* this one activity
@@ -965,7 +965,9 @@ class completion_info {
}
}
// Not there, get via SQL
// If cached completion data is not found, fetch via SQL.
// Fetch completion data for all of the activities in the course ONLY if we're caching the fetched completion data.
// If we're not caching the completion data, then just fetch the completion data for the user in this course module.
if ($usecache && $wholecourse) {
// Get whole course data for cache
$alldatabycmc = $DB->get_records_sql("