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

Lesson essays "disappear" if new attempt after exiting

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4.7, 2.5.3, 2.6, FRONTEND
    • Component/s: Lesson
    • Labels:
      None
    • Testing Instructions:
      Hide

      Have 2 browsers for teacher and student.

      1. Create a lesson with re-takes allowed and maximum number of attempts is 2.
      2. Create 2 essay questions.
      3. As student, submit an answer ("answer essay 1"), which will took the student to the next page.
      4. As teacher, go to 'grade essays' page. It should only display the student's name with no essay to click on
      5. As student, submit an answer for the second essay question ("answer essay 2"). I will go to the end of lesson page.
      6. As teacher, refresh the 'grade essay' page and make sure there are 2 essay responses.
      7. As student, re-attempt the lesson.
      8. Submit new answer for the question.
      9. Do not answer the second question. Go to other page. such as: site/course page.
      10. As teacher, the 'grade essay' page should only displaying 2 responses from the first attempt.
      11. As student, go back to the lesson and select 'yes' to return to the last viewed page.
      12. Submit an answer for the second essay question. It should direct the student to the end of lesson.
      13. as teacher, the 'grade essay' page should displaying 4 responses. (2 for each attempts).
      Show
      Have 2 browsers for teacher and student. Create a lesson with re-takes allowed and maximum number of attempts is 2. Create 2 essay questions. As student, submit an answer ("answer essay 1"), which will took the student to the next page. As teacher, go to 'grade essays' page. It should only display the student's name with no essay to click on As student, submit an answer for the second essay question ("answer essay 2"). I will go to the end of lesson page. As teacher, refresh the 'grade essay' page and make sure there are 2 essay responses. As student, re-attempt the lesson. Submit new answer for the question. Do not answer the second question. Go to other page. such as: site/course page. As teacher, the 'grade essay' page should only displaying 2 responses from the first attempt. As student, go back to the lesson and select 'yes' to return to the last viewed page. Submit an answer for the second essay question. It should direct the student to the end of lesson. as teacher, the 'grade essay' page should displaying 4 responses. (2 for each attempts).
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Sprint:
      FRONTEND Sprint 6
    • Story Points (Obsolete):
      8
    • Sprint:
      FRONTEND Sprint 6

      Description

      See this discussion: https://moodle.org/mod/forum/discuss.php?d=225141

      Diagnostic.-
      When a student exits a Lesson before reaching the last page, upon resuming that lesson they are offered a choice:

      You have seen more than one page of this lesson already.
      Do you want to start at the last page you saw?

      Unfortunately, in some cases the system to "goto last Unseen page" does not work as expected, which causes problems especially with Essays.

      Due to the complicated nature of the Lesson settings and flow, it is rather difficult to describe and reproduce the bug, but the patch I am attaching seems to resolve the issue, after thorough testing. The bug concerns all moodle 2 versions. Patch tested against current moodle 2.4 version only.

      Joseph

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              ankit_frenz Ankit Agarwal added a comment -

              I had a long discussion on this with Rosie, am still not 100% sure this is the correct way to go, although cannot think of many decent alternative.
              Anyway for the current patch following things need to be considered:-

              1. renaming $corrrectattempts, since now its all attempts
              2. $jumpto == 0 is not unlikely anymore, since we are considering all attempts.
              3. There should be an else to if ($nattempts >= $lesson->maxattempts) { for the following case
              • I made an attempt on a question and it was wrong
              • I have more attempts left
              • nav for wrong answer for the same is set to "this page"
              • So when I return to lesson I should be shown the same page not next
              1. The alternative way I can think of is updating get_attempts api to consider returning essay questions. (another param may be?)

              Thanks

              Show
              ankit_frenz Ankit Agarwal added a comment - I had a long discussion on this with Rosie, am still not 100% sure this is the correct way to go, although cannot think of many decent alternative. Anyway for the current patch following things need to be considered:- renaming $corrrectattempts, since now its all attempts $jumpto == 0 is not unlikely anymore, since we are considering all attempts. There should be an else to if ($nattempts >= $lesson->maxattempts) { for the following case I made an attempt on a question and it was wrong I have more attempts left nav for wrong answer for the same is set to "this page" So when I return to lesson I should be shown the same page not next The alternative way I can think of is updating get_attempts api to consider returning essay questions. (another param may be?) Thanks
              Hide
              rezeau Joseph Rézeau added a comment -

              Ankit Agarwal added a comment - 28/Mar/13 9:00 AM

              I will shortly examine this scenario and come back with comments.

              Joseph

              Show
              rezeau Joseph Rézeau added a comment - Ankit Agarwal added a comment - 28/Mar/13 9:00 AM I will shortly examine this scenario and come back with comments. Joseph
              Hide
              rezeau Joseph Rézeau added a comment -

              @Ankit ,

              If a Lesson's Maximum number of attempts is set to higher than 1 it is unlikely that a student will leave a Lesson without having used his number of allowed attempts at a question. But it MAY happen, so we must make sure that things work OK in that case.

              I have re-tested my proposed patch with a Lesson set to Maximum number of attempts > 1 and things do not work as expected, so this needs more thinking. Not tested yet, but I think that a solution might be as follows:

              case #1 : Maximum number of attempts > 1 : proceed as before my patch
              case #2 : Maximum number of attempts = 1 : use my patch

              Joseph

              Show
              rezeau Joseph Rézeau added a comment - @Ankit , If a Lesson's Maximum number of attempts is set to higher than 1 it is unlikely that a student will leave a Lesson without having used his number of allowed attempts at a question. But it MAY happen, so we must make sure that things work OK in that case. I have re-tested my proposed patch with a Lesson set to Maximum number of attempts > 1 and things do not work as expected, so this needs more thinking. Not tested yet, but I think that a solution might be as follows: case #1 : Maximum number of attempts > 1 : proceed as before my patch case #2 : Maximum number of attempts = 1 : use my patch Joseph
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Hi Joseph,

              Could you review the updated patch and report any feedback?

              Thanks
              Rosie

              Show
              rwijaya Rossiani Wijaya added a comment - Hi Joseph, Could you review the updated patch and report any feedback? Thanks Rosie
              Hide
              rezeau Joseph Rézeau added a comment -

              Hi Rossiani,
              I'm trying to test this bug on current moodle 2.5.2+ but I have a problem.
              I created a Lesson with 2 essay questions plus a couple of MCQ questions.
              As a student if I submit one essay and then quit the lesson, when I re-enter the Lesson, either it does not offer to "return to the last viewed page" or it does, but my first answer to essay 1 has disappeared and I have to re-enter a new one.
              Which means that now we have a different bug, i.e. "in a lesson with essays", quitting lesson after submitting one or more essays but before the end of the lesson, when resuming lesson we are not offered to return to the last viewed page !!!

              Show
              rezeau Joseph Rézeau added a comment - Hi Rossiani, I'm trying to test this bug on current moodle 2.5.2+ but I have a problem. I created a Lesson with 2 essay questions plus a couple of MCQ questions. As a student if I submit one essay and then quit the lesson, when I re-enter the Lesson, either it does not offer to "return to the last viewed page" or it does, but my first answer to essay 1 has disappeared and I have to re-enter a new one. Which means that now we have a different bug, i.e. "in a lesson with essays", quitting lesson after submitting one or more essays but before the end of the lesson, when resuming lesson we are not offered to return to the last viewed page !!!
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Hi Joseph,

              Could you check whether your setting for 're-takes allowed' is enabled?

              Show
              rwijaya Rossiani Wijaya added a comment - Hi Joseph, Could you check whether your setting for 're-takes allowed' is enabled?
              Hide
              rezeau Joseph Rézeau added a comment -

              yes it is

              Show
              rezeau Joseph Rézeau added a comment - yes it is
              Hide
              rwijaya Rossiani Wijaya added a comment -

              I tested this on 2.5, after submitting the first essay question, quit the lesson and returned to the lesson again. It displayed the option to return to last view page. Selecting yes, it directed me to the next question which is the second essay.

              I will looked into this again first thing tomorrow.

              Show
              rwijaya Rossiani Wijaya added a comment - I tested this on 2.5, after submitting the first essay question, quit the lesson and returned to the lesson again. It displayed the option to return to last view page. Selecting yes, it directed me to the next question which is the second essay. I will looked into this again first thing tomorrow.
              Hide
              rezeau Joseph Rézeau added a comment -

              What kind of questions do you have in your lessson? ONly 2 or 3 essays or other questions as well?

              Show
              rezeau Joseph Rézeau added a comment - What kind of questions do you have in your lessson? ONly 2 or 3 essays or other questions as well?
              Hide
              rwijaya Rossiani Wijaya added a comment -

              I have 2 essays and 2 mcq questions for the lesson.

              Show
              rwijaya Rossiani Wijaya added a comment - I have 2 essays and 2 mcq questions for the lesson.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              I retested this again with 2 essays and 2 mcq questions, it works as expected.

              The only way to make it overwrite the previous question is by selecting 'no' for 'return to last item viewed page'.

              Show
              rwijaya Rossiani Wijaya added a comment - I retested this again with 2 essays and 2 mcq questions, it works as expected. The only way to make it overwrite the previous question is by selecting 'no' for 'return to last item viewed page'.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Hi Joseph,

              Would it possible to backup your lesson activity so I could test it?

              Show
              rwijaya Rossiani Wijaya added a comment - Hi Joseph, Would it possible to backup your lesson activity so I could test it?
              Hide
              rezeau Joseph Rézeau added a comment -

              @Rossiani, I've re-tested this with a lesson containing the following: Tested on latest version of Moodle 2.5
              Q1: MCQ01
              Q2: Essay01
              Q3: MCQ02
              Q4: Essay02
              ---------
              Before applying your fix, things do not work as expected.
              After applying it, things work OK.
              I think your fix is good to go! Thanks.

              Show
              rezeau Joseph Rézeau added a comment - @Rossiani, I've re-tested this with a lesson containing the following: Tested on latest version of Moodle 2.5 Q1: MCQ01 Q2: Essay01 Q3: MCQ02 Q4: Essay02 --------- Before applying your fix, things do not work as expected. After applying it, things work OK. I think your fix is good to go! Thanks.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Thanks Joseph for testing this.

              I will re-test your lesson structure just to make sure everything is working as expected.

              Show
              rwijaya Rossiani Wijaya added a comment - Thanks Joseph for testing this. I will re-test your lesson structure just to make sure everything is working as expected.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Re-tested with Joseph questions structure and works as expected.

              Sending for peer-review.

              Show
              rwijaya Rossiani Wijaya added a comment - Re-tested with Joseph questions structure and works as expected. Sending for peer-review.
              Hide
              ankit_frenz Ankit Agarwal added a comment - - edited

              Hi Rosie,

              1. We should not be using $DB->count_records as we already have an api get_attempts, which eventually can implement caching at some point. If you feel get_attempts() is not good enough, you can introduce a new api, and which can be used later on in other places as well.
              2. should we not be using $lesson->get_next_page()? For the situation $nattempts >= $lesson->maxattempts instead of getting it directly from database? or all the extra processing that $lesson->get_next_page() is not required at this point?

              Rest looks good.
              Thanks

              Show
              ankit_frenz Ankit Agarwal added a comment - - edited Hi Rosie, We should not be using $DB->count_records as we already have an api get_attempts, which eventually can implement caching at some point. If you feel get_attempts() is not good enough, you can introduce a new api, and which can be used later on in other places as well. should we not be using $lesson->get_next_page()? For the situation $nattempts >= $lesson->maxattempts instead of getting it directly from database? or all the extra processing that $lesson->get_next_page() is not required at this point? Rest looks good. Thanks
              Hide
              ankit_frenz Ankit Agarwal added a comment -

              Thanks for making changes Rosie.

              Please feel to push forward.

              Show
              ankit_frenz Ankit Agarwal added a comment - Thanks for making changes Rosie. Please feel to push forward.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Thanks Ankit for reviewing.

              Pushing for integration review.

              Show
              rwijaya Rossiani Wijaya added a comment - Thanks Ankit for reviewing. Pushing for integration review.
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

              TIA and ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
              Hide
              marina Marina Glancy added a comment -

              Rossi, I found and created another must fix bug for lesson: MDL-42650

              Show
              marina Marina Glancy added a comment - Rossi, I found and created another must fix bug for lesson: MDL-42650
              Hide
              marina Marina Glancy added a comment -

              leaving this till the next week, I'm not able to test it today

              Show
              marina Marina Glancy added a comment - leaving this till the next week, I'm not able to test it today
              Hide
              marina Marina Glancy added a comment -

              Thanks Rossi, integrated in 2.4, 2.5 and master

              Show
              marina Marina Glancy added a comment - Thanks Rossi, integrated in 2.4, 2.5 and master
              Hide
              rajeshtaneja Rajesh Taneja added a comment -

              Thanks for fixing this Rossie,

              Works as expected... Passing...

              Show
              rajeshtaneja Rajesh Taneja added a comment - Thanks for fixing this Rossie, Works as expected... Passing...
              Hide
              damyon Damyon Wiese added a comment -

              Here lies 52 bugs.
              All fixed or swept under a rug.
              If they come back one day,
              To our dismay,
              We all will feel quite un-smug.

              Thanks for the reporting/fixing/testing on this issue. It has been sent upstream.

              Show
              damyon Damyon Wiese added a comment - Here lies 52 bugs. All fixed or swept under a rug. If they come back one day, To our dismay, We all will feel quite un-smug. Thanks for the reporting/fixing/testing on this issue. It has been sent upstream.

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Nov/13