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

Converted PDF file does not update when submission file is overwritten

XMLWordPrintable

    • MOODLE_35_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MDL-68943-master
    • Hide

      Prerequisites

      1. A course with an assignment module
      2. Three users enrolled in the course from 1 (we'll call them Student A, Student B, and Student C)

      Testing

      Without the patch applied

      1. You need to make sure you're running a site WITHOUT the patch applied first. To do that:
        • Create a fresh instance, but don't install yet
        • Checkout the latest weekly or on-demand release:
          • For master:

            git checkout 35f39c45b75 

          • For 400:

            git checkout dbb2deed8c0

          • For 311:

            git checkout 24bc7e9a196

        • Install the site as normal
      2. Install and enable the dummy fileconverter plugin
        1. git clone git@github.com:catalyst/moodle-fileconverter_dummy.git files/converter/dummy
        2. Browse to "Site administration > Plugins > Document converters > Manage document converters" and open the eye on the "Dummy" converter - ensure all other converters are disabled
      3. As Student A browse to the assignment and submit a text file with some small amount of content in it, e.g.,:

        myfileA.txt

        this is Student A's submission
        

      4. Do the same as Student B but with a different text file containing different content, e.g.,:

        myfileB.txt

        this is Student B's submission
        

      5. Run the relevant command to process the adhoc/scheduled task:
        • For master:

          php admin/cli/adhoc_task.php -e
          

        • For 4.0 and 3.11:

          php admin/cli/scheduled_task.php --execute=\\assignfeedback_editpdf\\task\\convert_submissions
          

      6. Verify you see some output from the dummy converter showing conversions started for both students:

        Execute adhoc task: assignfeedback_editpdf\task\convert_submission
        Adhoc task id: 3
        Adhoc task custom data: {"submissionid":"2","submissionattempt":"0"}
        ... started 16:59:27. Current memory use 21.6 MB.
        Converting submission for user id 3
        Dummy conversion started.
        Conversion still in progress. Requeueing self to check again.
        ... used 42 dbqueries
        ... used 0.27109098434448 seconds
        Adhoc task complete: assignfeedback_editpdf\task\convert_submission
        Execute adhoc task: assignfeedback_editpdf\task\convert_submission
        Adhoc task id: 4
        Adhoc task custom data: {"submissionid":"3","submissionattempt":"0"}
        ... started 16:59:28. Current memory use 38.8 MB.
        Converting submission for user id 4
        Dummy conversion started.
        Conversion still in progress. Requeueing self to check again.
        ... used 31 dbqueries
        ... used 0.14274597167969 seconds
        Adhoc task complete: assignfeedback_editpdf\task\convert_submission
        

      7. Wait 60 seconds and run the adhoc/scheduled task again
      8. Verify you see some output from the dummy converter showing conversions completed for both students:

        Execute adhoc task: assignfeedback_editpdf\task\convert_submission
        Adhoc task id: 5
        Adhoc task custom data: {"submissionid":"2","submissionattempt":"0"}
        ... started 17:00:44. Current memory use 14.3 MB.
        Converting submission for user id 3
        Dummy conversion completed.
        The document has been successfully converted
        ... used 108 dbqueries
        ... used 1.248309135437 seconds
        Adhoc task complete: assignfeedback_editpdf\task\convert_submission
        Execute adhoc task: assignfeedback_editpdf\task\convert_submission
        Adhoc task id: 6
        Adhoc task custom data: {"submissionid":"3","submissionattempt":"0"}
        ... started 17:00:45. Current memory use 50.3 MB.
        Converting submission for user id 4
        Dummy conversion completed.
        The document has been successfully converted
        ... used 103 dbqueries
        ... used 1.1581900119781 seconds
        Adhoc task complete: assignfeedback_editpdf\task\convert_submission
        

      9. Tail your error logs as the next steps are carried out, e.g.,: tail -f /var/log/apache2/error.log
      10. As admin, navigate to the assignment and view all submissions
      11. Click the "Grade" button next to Student A
      12. Verify that the text shown in the grader interface is the same as the text in the submitted text file
      13. Repeat for Student B
      14. Verify there is nothing in the error logs about document conversions
      15. Edit Student A's text file locally (NB do not change the filename), adding some content; e.g.,

        myfile.txt

        this is Student A's submission
         
        with some extra content
        

      16. As the student, go back to the assignment submission page
      17. Press "Edit submission"
      18. Upload the same text file (that you just modified)
      19. You should be prompted to overwrite or rename the file, press "Overwrite"
      20. Press "Save changes"
      21. Run the scheduled/adhoc task again, no output from the dummy converter should be present (there should be no "Dummy conversion ..." lines)
      22. As admin, grade Student A's assignment, the content should not have changed (will will verify that the upgrade fixes this)

      With the patch applied

      1. Apply the patch and run the upgrade from the CLI: php admin/cli/upgrade.php
      2. Run adhoc tasks:

        php admin/cli/adhoc_task.php -e
        

      3. Verify you see some output indicating that one (and only one) submission has had its timemodified updated:

        Execute adhoc task: assignfeedback_editpdf\task\bump_submission_for_stale_conversions
        Adhoc task id: 6
        Adhoc task custom data:
        ... started 11:25:14. Current memory use 40.1 MB.
        Set submission 2 timemodified to 1661484205
        ... used 5 dbqueries
        ... used 0.037574052810669 seconds
        Adhoc task complete: assignfeedback_editpdf\task\bump_submission_for_stale_conversions
        

      4. Tail your error logs  (E.g. tail -f /var/log/apache2/error.log)
      5. As admin, grade Student A's submission
      6. Verify you see some output from the dummy converter in the error logs:

        [Tue Aug 23 17:11:04.326063 2022] [php7:notice] [pid 1076237] [client 127.0.0.1:45092] Dummy conversion started., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=3
        [Tue Aug 23 17:11:05.503660 2022] [php7:notice] [pid 1076237] [client 127.0.0.1:45092] Dummy conversion completed., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=3
        

      7. Verify the content has updated in the assignment grader and now matches the text file
      8. As admin, grade Student B's assignment
      9. Verify no output from the dummy converter is present in the error logs
      10. As Student C browse to the assignment and submit a text file with some small amount of content in it, e.g.,:

        myfileC.txt

        this is Student C's submission
        

      11. Run the relevant adhoc/scheduled task and verify there is output from the dummy converter about Student C's submission (and no output about any other submissions):

        Adhoc task custom data: {"submissionid":"4","submissionattempt":"0"}
        ... started 17:19:01. Current memory use 21.5 MB.
        Converting submission for user id 5
        Dummy conversion started.
        Conversion still in progress. Requeueing self to check again.
        ... used 35 dbqueries
        ... used 0.218022108078 seconds
        Adhoc task complete: assignfeedback_editpdf\task\convert_submission
        

      12. Wait 60 seconds and run it again to complete the conversion
      13. As admin, grade Student C's submission
      14. Verify that the text shown in the grader interface is the same as the text in the submitted text file
      15. Edit Student C's text file locally (NB do not change the filename), adding some content; e.g.,

        myfileC.txt

        this is Student C's submission
         
        with some extra content
        

      16. As Student C, go back to the assignment submission page
      17. Press "Edit submission"
      18. Upload the same text file (that you just modified)
      19. You should be prompted to overwrite or rename the file, press "Overwrite"
      20. Press "Save changes"
      21. Tail your error logs  (E.g. tail -f /var/log/apache2/error.log)
      22. As admin, grade Student C's submission
      23. Verify you see some output from the dummy converter in the error logs:

        [Tue Aug 23 17:22:33.474669 2022] [php7:notice] [pid 2575696] [client 127.0.0.1:45202] Dummy conversion started., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=5
        [Tue Aug 23 17:22:34.640888 2022] [php7:notice] [pid 2717556] [client 127.0.0.1:45208] Dummy conversion completed., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=5
        

      24. Verify the content has updated in the assignment grader and now matches the text file

      Regression testing

      NB: It's probably easiest to do this on a fresh install. The prerequisites are the same as before. You'll need:

      • A course with 3 students enrolled
      • Installed and enabled the dummy document converter plugin (Refer to Step 2 earlier in the testing for details on how to install + enable this plugin)
      1. As Student A browse to the assignment and submit a text file with some small amount of content in it, e.g.,:

        myfile.txt

        this is my text file
        

      2. Run the relevant command to process the adhoc/scheduled task:
        • For master:

          php admin/cli/adhoc_task.php -e
          

        • For 4.0 and 3.11:

          php admin/cli/scheduled_task.php --execute=\\assignfeedback_editpdf\\task\\convert_submissions
          

      3. Verify you see some output from the dummy converter that says:

        Convert 1 submission attempt(s) for assignment 1
        Dummy conversion started.
        

      4. Wait 60 seconds and then run the adhoc/scheduled task again
      5. Verify you see some output from the dummy converter that says:

        Convert 1 submission attempt(s) for assignment 1
        Dummy conversion completed.
        

      6. As admin, navigate to the assignment and view all submissions
      7. Click the "Grade" button net to student A
      8. Verify that the text shown in the grader interface is the same as the text in the submitted text file
      9. As student B, submit the exact same text file
      10. Run the relevant conversion command as per step 2
      11. Verify you do not see any output from the dummy converter (i.e., there should be no "Dummy conversion ..." lines)
      12. As admin, navigate to the assignment and view all submissions
      13. Click the "Grade" button net to student B
      14. Verify that the text shown in the grader interface is the same as the text in the submitted text file
      Show
      Prerequisites A course with an assignment module Three users enrolled in the course from 1 (we'll call them Student A, Student B, and Student C) Testing Without the patch applied You need to make sure you're running a site WITHOUT the patch applied first. To do that: Create a fresh instance, but don't install yet Checkout the latest weekly or on-demand release: For master: git checkout 35f39c45b75 For 400: git checkout dbb2deed8c0 For 311: git checkout 24bc7e9a196 Install the site as normal Install and enable the dummy fileconverter plugin git clone git@github.com:catalyst/moodle-fileconverter_dummy.git files/converter/dummy Browse to "Site administration > Plugins > Document converters > Manage document converters" and open the eye on the "Dummy" converter - ensure all other converters are disabled As Student A browse to the assignment and submit a text file with some small amount of content in it, e.g.,: myfileA.txt this is Student A's submission Do the same as Student B but with a different text file containing different content, e.g.,: myfileB.txt this is Student B's submission Run the relevant command to process the adhoc/scheduled task: For master : php admin/cli/adhoc_task.php -e For 4.0 and 3.11 : php admin/cli/scheduled_task.php --execute=\\assignfeedback_editpdf\\task\\convert_submissions Verify you see some output from the dummy converter showing conversions started for both students: Execute adhoc task: assignfeedback_editpdf\task\convert_submission Adhoc task id: 3 Adhoc task custom data: {"submissionid":"2","submissionattempt":"0"} ... started 16:59:27. Current memory use 21.6 MB. Converting submission for user id 3 Dummy conversion started. Conversion still in progress. Requeueing self to check again. ... used 42 dbqueries ... used 0.27109098434448 seconds Adhoc task complete: assignfeedback_editpdf\task\convert_submission Execute adhoc task: assignfeedback_editpdf\task\convert_submission Adhoc task id: 4 Adhoc task custom data: {"submissionid":"3","submissionattempt":"0"} ... started 16:59:28. Current memory use 38.8 MB. Converting submission for user id 4 Dummy conversion started. Conversion still in progress. Requeueing self to check again. ... used 31 dbqueries ... used 0.14274597167969 seconds Adhoc task complete: assignfeedback_editpdf\task\convert_submission Wait 60 seconds and run the adhoc/scheduled task again Verify you see some output from the dummy converter showing conversions completed for both students: Execute adhoc task: assignfeedback_editpdf\task\convert_submission Adhoc task id: 5 Adhoc task custom data: {"submissionid":"2","submissionattempt":"0"} ... started 17:00:44. Current memory use 14.3 MB. Converting submission for user id 3 Dummy conversion completed. The document has been successfully converted ... used 108 dbqueries ... used 1.248309135437 seconds Adhoc task complete: assignfeedback_editpdf\task\convert_submission Execute adhoc task: assignfeedback_editpdf\task\convert_submission Adhoc task id: 6 Adhoc task custom data: {"submissionid":"3","submissionattempt":"0"} ... started 17:00:45. Current memory use 50.3 MB. Converting submission for user id 4 Dummy conversion completed. The document has been successfully converted ... used 103 dbqueries ... used 1.1581900119781 seconds Adhoc task complete: assignfeedback_editpdf\task\convert_submission Tail your error logs as the next steps are carried out, e.g.,: tail -f /var/log/apache2/error.log As admin, navigate to the assignment and view all submissions Click the "Grade" button next to Student A Verify that the text shown in the grader interface is the same as the text in the submitted text file Repeat for Student B Verify there is nothing in the error logs about document conversions Edit Student A's text file locally ( NB do not change the filename), adding some content; e.g., myfile.txt this is Student A's submission   with some extra content As the student, go back to the assignment submission page Press "Edit submission" Upload the same text file (that you just modified) You should be prompted to overwrite or rename the file, press "Overwrite" Press "Save changes" Run the scheduled/adhoc task again, no output from the dummy converter should be present (there should be no "Dummy conversion ..." lines) As admin, grade Student A's assignment, the content should not have changed (will will verify that the upgrade fixes this) With the patch applied Apply the patch and run the upgrade from the CLI: php admin/cli/upgrade.php Run adhoc tasks: php admin/cli/adhoc_task.php -e Verify you see some output indicating that one (and only one) submission has had its timemodified updated: Execute adhoc task: assignfeedback_editpdf\task\bump_submission_for_stale_conversions Adhoc task id: 6 Adhoc task custom data: ... started 11:25:14. Current memory use 40.1 MB. Set submission 2 timemodified to 1661484205 ... used 5 dbqueries ... used 0.037574052810669 seconds Adhoc task complete: assignfeedback_editpdf\task\bump_submission_for_stale_conversions Tail your error logs  (E.g. tail -f /var/log/apache2/error.log ) As admin, grade Student A's submission Verify you see some output from the dummy converter in the error logs: [Tue Aug 23 17:11:04.326063 2022] [php7:notice] [pid 1076237] [client 127.0.0.1:45092] Dummy conversion started., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=3 [Tue Aug 23 17:11:05.503660 2022] [php7:notice] [pid 1076237] [client 127.0.0.1:45092] Dummy conversion completed., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=3 Verify the content has updated in the assignment grader and now matches the text file As admin, grade Student B's assignment Verify no output from the dummy converter is present in the error logs As Student C browse to the assignment and submit a text file with some small amount of content in it, e.g.,: myfileC.txt this is Student C's submission Run the relevant adhoc/scheduled task and verify there is output from the dummy converter about Student C's submission (and no output about any other submissions): Adhoc task custom data: {"submissionid":"4","submissionattempt":"0"} ... started 17:19:01. Current memory use 21.5 MB. Converting submission for user id 5 Dummy conversion started. Conversion still in progress. Requeueing self to check again. ... used 35 dbqueries ... used 0.218022108078 seconds Adhoc task complete: assignfeedback_editpdf\task\convert_submission Wait 60 seconds and run it again to complete the conversion As admin, grade Student C's submission Verify that the text shown in the grader interface is the same as the text in the submitted text file Edit Student C's text file locally ( NB do not change the filename), adding some content; e.g., myfileC.txt this is Student C's submission   with some extra content As Student C, go back to the assignment submission page Press "Edit submission" Upload the same text file (that you just modified) You should be prompted to overwrite or rename the file, press "Overwrite" Press "Save changes" Tail your error logs  (E.g. tail -f /var/log/apache2/error.log ) As admin, grade Student C's submission Verify you see some output from the dummy converter in the error logs: [Tue Aug 23 17:22:33.474669 2022] [php7:notice] [pid 2575696] [client 127.0.0.1:45202] Dummy conversion started., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=5 [Tue Aug 23 17:22:34.640888 2022] [php7:notice] [pid 2717556] [client 127.0.0.1:45208] Dummy conversion completed., referer: http://localhost/m/stable_master/mod/assign/view.php?id=2&rownum=0&action=grader&userid=5 Verify the content has updated in the assignment grader and now matches the text file Regression testing NB: It's probably easiest to do this on a fresh install. The prerequisites are the same as before. You'll need: A course with 3 students enrolled Installed and enabled the dummy document converter plugin (Refer to Step 2 earlier in the testing for details on how to install + enable this plugin) As Student A browse to the assignment and submit a text file with some small amount of content in it, e.g.,: myfile.txt this is my text file Run the relevant command to process the adhoc/scheduled task: For master : php admin/cli/adhoc_task.php -e For 4.0 and 3.11 : php admin/cli/scheduled_task.php --execute=\\assignfeedback_editpdf\\task\\convert_submissions Verify you see some output from the dummy converter that says: Convert 1 submission attempt(s) for assignment 1 Dummy conversion started. Wait 60 seconds and then run the adhoc/scheduled task again Verify you see some output from the dummy converter that says: Convert 1 submission attempt(s) for assignment 1 Dummy conversion completed. As admin, navigate to the assignment and view all submissions Click the "Grade" button net to student A Verify that the text shown in the grader interface is the same as the text in the submitted text file As student B, submit the exact same text file Run the relevant conversion command as per step 2 Verify you do not see any output from the dummy converter (i.e., there should be no "Dummy conversion ..." lines) As admin, navigate to the assignment and view all submissions Click the "Grade" button net to student B Verify that the text shown in the grader interface is the same as the text in the submitted text file

      When using a fileconverter and overwriting a submission file in the file picker, the new file will not be converted to a pdf. Instead, the old pdf will be displayed when grading.

      If you delete the old file before uploading the new one, the new file will be properly converted and displayed when grading.

      I found the bug while using fileconverter_onlyoffice (https://moodle.org/plugins/fileconverter_onlyoffice). However, to ensure that it isn't the plugins fault, I also tested it with a very simple dummy-converter that is attached to this issue. It just logs every conversion request into moodledata/converter.log.

      Reproduction steps:

      • Unzip fileconverter_converterlog.zip into /files/converter and install the plugin.
      • Enable only the Converterlog in Site Administration - Plugins - Document converters - Manage document converters.
      • Create a course.
      • Enrol yourself as teacher and student.
      • Create an assignment with "Annotate PDF" as Feedback type (If the option isn't available, install ghostscript).
      • Create a textfile and put some content into it.
      • Add the textfile as your submission for the assignment.
      • Click "Grade".
      • Look into <moodledata>/converter.log. A line with your filename and filecontent was generated.
      • Edit the textfile to some other content.
      • Go back to the assignment and click on "Edit submission".
      • Drag the edited textfile into the filepicker.
      • Click "Overwrite".
      • Click "Save changes".
      • Click "Grade".
      • Look into the converterlog. There is no new line there, so the changed file would not have been converted.

        1. dummy.zip
          31 kB
        2. fileconverter_converterlog.zip
          3 kB
        3. MDL-68943_after_1.png
          MDL-68943_after_1.png
          71 kB
        4. MDL-68943_after_2.png
          MDL-68943_after_2.png
          229 kB
        5. MDL-68943_after_3.png
          MDL-68943_after_3.png
          199 kB
        6. MDL-68943_after_4.png
          MDL-68943_after_4.png
          107 kB
        7. MDL-68943_after_5.png
          MDL-68943_after_5.png
          226 kB
        8. MDL-68943_before_1.png
          MDL-68943_before_1.png
          100 kB
        9. MDL-68943_before_2.png
          MDL-68943_before_2.png
          94 kB
        10. MDL-68943_before_3.png
          MDL-68943_before_3.png
          108 kB
        11. MDL-68943_before_4.png
          MDL-68943_before_4.png
          107 kB
        12. MDL-68943_before_5.png
          MDL-68943_before_5.png
          165 kB
        13. MDL-68943_before_6.png
          MDL-68943_before_6.png
          146 kB
        14. MDL-68943_before_7.png
          MDL-68943_before_7.png
          111 kB
        15. MDL-68943_regression_1.png
          MDL-68943_regression_1.png
          106 kB
        16. MDL-68943_regression_2.png
          MDL-68943_regression_2.png
          105 kB
        17. MDL-68943_regression_3.png
          MDL-68943_regression_3.png
          55 kB
        18. MDL-68943_regression_4.png
          MDL-68943_regression_4.png
          105 kB

            cameron1729 cameron1729
            justusdieckmann Justus Dieckmann
            Misha Golenkov Misha Golenkov
            Jake Dallimore Jake Dallimore
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            10 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 52 minutes
                5h 52m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.