Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66694

Add columns for word count and character count to the forum summary report

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Before patch
      1. Checkout the weekly release before this patch has been applied.
      2. Install the Moodle instance.
      3. Log in as admin
      4. Create an 'S' size course in site admin > development > make test course
      5. Backup the course including user data.
      6. Download the backup file.
      Upgrade
      1. Upgrade to the latest Moodle version with this patch applied.
      2. Create a brand new Forum The new one
      3. Log in as one of the students in the course (Remember the name of the student or write it down, you will need it later).
      4. Write a couple of posts in the activity Forum (section 0).
      5. Navigate to The new one forum, post a new discussion with the text "First discussion", then reply to that discussion with the text "First reply" (use those exact messages, as they are relevant to the results later).
      6. Log in back as admin and go to Forum, click on the forum admin 'cog' icon and select Summary report
      7. You SHOULD NOT see a Word count nor a Char count column
      8. Now go to The new one, click on the forum admin 'cog' icon and select Summary report
      9. You SHOULD see a Word count and a Char count column in The new one
      10. CONFIRM the word count for the student used in step 2 is 4, and the character count is 25.
      11. Run the following command in CLI:

        php admin/cli/cron.php

      12. Go to Forum, click on the forum admin 'cog' icon and select Summary report
      13. You SHOULD now see a Word count and a Char count column in the report.
      Restore
      1. Restore the course with user data into a new course.
      2. Go to the restored course
      3. Go to Forum, click on the forum admin 'cog' icon and select Summary report
      4. You SHOULD now see a Word count and a Char count column in the report.
      5. Confirm that the Word and Character count columns match the Word and Character count columns of the Forum activity in the original course.
      Show
      Before patch Checkout the weekly release before this patch has been applied. Install the Moodle instance. Log in as admin Create an 'S' size course in site admin > development > make test course Backup the course including user data. Download the backup file. Upgrade Upgrade to the latest Moodle version with this patch applied. Create a brand new Forum The new one Log in as one of the students in the course (Remember the name of the student or write it down, you will need it later). Write a couple of posts in the activity Forum (section 0). Navigate to The new one forum, post a new discussion with the text "First discussion", then reply to that discussion with the text "First reply" (use those exact messages, as they are relevant to the results later). Log in back as admin and go to Forum , click on the forum admin 'cog' icon and select Summary report You SHOULD NOT see a Word count nor a Char count column Now go to The new one , click on the forum admin 'cog' icon and select Summary report You SHOULD see a Word count and a Char count column in The new one CONFIRM the word count for the student used in step 2 is 4 , and the character count is 25 . Run the following command in CLI: php admin/cli/cron.php Go to Forum , click on the forum admin 'cog' icon and select Summary report You SHOULD now see a Word count and a Char count column in the report. Restore Restore the course with user data into a new course. Go to the restored course Go to Forum , click on the forum admin 'cog' icon and select Summary report You SHOULD now see a Word count and a Char count column in the report. Confirm that the Word and Character count columns match the Word and Character count columns of the Forum activity in the original course.
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull Master Branch:
      MDL-66694-master
    • Sprint:
      Internationals - 3.8 Alpha

      Description

      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:

      1. Add columns to the forum_posts database table for each.
      2. Calculate and store the word and character count of a post when it is created or updated.
      3. 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:

      1. The report should not show the columns if all posts in the reported forum have not been calculated.
      2. 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.
      3. 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).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days, 59 minutes
                  3d 59m