-
Task
-
Resolution: Fixed
-
Minor
-
3.8
-
MOODLE_38_STABLE
-
MOODLE_38_STABLE
-
MDL-66694-master -
-
Internationals - 3.8 Alpha
Two columns need to be created in the forum summary report, one for word count, and the other for character count.
It is too expensive to calculate this at reporting time, so a plausible approach is to:
- Add columns to the forum_posts database table for each.
- Calculate and store the word and character count of a post when it is created or updated.
- Create an ad-hoc task that chunks through all forum posts in the database by (say) 1000 at a time, calculates their word/character counts, then updates the values in the database, then ceases to run once no more posts have empty values for those columns.
The result will be that a simple SUM will be required to generate both metrics for the report.
Some things to consider:
- The report should not show the columns if all posts in the reported forum have not been calculated.
- It may be possible to prioritise posts within any forum where the report has been accessed, so that they are available sooner, since a user is trying to access the information.
- If the data is not ready, perhaps display a message on the page to indicate that is the case (and if #2 is possible, perhaps indicate the user should check back in a few hours).