Moodle
  1. Moodle
  2. MDL-29558

for a question with many variants we only want to allow the user to preview the first 20

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.2, 2.2
    • Fix Version/s: 2.1.2
    • Component/s: Questions
    • Labels:
      None
    • Testing Instructions:
      Hide

      1. Either create a calculated question with 100s of variants (dataset items); or temporarily hack one of the installed question types so that get_num_variants() return something big like 1000000, or install https://github.com/jamiepratt/moodle-qtype_varnumeric

      2. Preview that question. Verify that the dropdown where you can select which variant to preview does not have more than 100 entries.

      Show
      1. Either create a calculated question with 100s of variants (dataset items); or temporarily hack one of the installed question types so that get_num_variants() return something big like 1000000, or install https://github.com/jamiepratt/moodle-qtype_varnumeric 2. Preview that question. Verify that the dropdown where you can select which variant to preview does not have more than 100 entries.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull Master Branch:
    • Rank:
      19424

      Description

      In the question preview window we need to restrict how many question variants can be selected.

      We thought allowing preview of the first 20 was sensible.

        Activity

        Hide
        Tim Hunt added a comment -

        I think it is OK for 20 be a constant in the code (previewlib.php?). I don't think it needs to be configurable by admins. I wonder if 100 would be a better value?

        Thanks for doing this Jamie.

        Show
        Tim Hunt added a comment - I think it is OK for 20 be a constant in the code (previewlib.php?). I don't think it needs to be configurable by admins. I wonder if 100 would be a better value? Thanks for doing this Jamie.
        Hide
        Jamie Pratt added a comment -
        Show
        Jamie Pratt added a comment - https://github.com/jamiepratt/moodle/compare/master...MDL-29558 https://github.com/jamiepratt/moodle/compare/MOODLE_21_STABLE...MDL-29558_2_1 I put the constant in preview.php but of course it might be moved to previewlib.php
        Hide
        Tim Hunt added a comment -

        Almost perfect, but

        1. line 38 of the patch is a spurious blank line (https://github.com/jamiepratt/moodle/compare/master...MDL-29558#L0R38)

        2. The commit comment is very long, and does not start with the part of the code affected. Could I suggest something like this as an alternative:

        <pre>
        MDL-29558 question preview: limit variants drop-down to the first 100

        In situations when question has many variants.
        </pre>

        Could I ask you to do a quick git commit --amend to fix these two things, then I will submit it for integration. Thanks.

        Show
        Tim Hunt added a comment - Almost perfect, but 1. line 38 of the patch is a spurious blank line ( https://github.com/jamiepratt/moodle/compare/master...MDL-29558#L0R38 ) 2. The commit comment is very long, and does not start with the part of the code affected. Could I suggest something like this as an alternative: <pre> MDL-29558 question preview: limit variants drop-down to the first 100 In situations when question has many variants. </pre> Could I ask you to do a quick git commit --amend to fix these two things, then I will submit it for integration. Thanks.
        Hide
        Jamie Pratt added a comment -

        OK. See the links above. I (force) pushed again to both branches.

        I like the suggested layout of commit messages and will henceforth format my messages like that. The blank second line is intentional right? Is there a current recommended Moodle format? How many character per line is optimal I wonder?

        Ah, I found this :

        http://docs.moodle.org/dev/Commit_cheat_sheet (but darn no recommendation on line length)

        and then this discussion :

        http://moodle.org/mod/forum/discuss.php?d=180415

        It says less than approx 80 characters. So will stick to that.

        Show
        Jamie Pratt added a comment - OK. See the links above. I (force) pushed again to both branches. I like the suggested layout of commit messages and will henceforth format my messages like that. The blank second line is intentional right? Is there a current recommended Moodle format? How many character per line is optimal I wonder? Ah, I found this : http://docs.moodle.org/dev/Commit_cheat_sheet (but darn no recommendation on line length) and then this discussion : http://moodle.org/mod/forum/discuss.php?d=180415 It says less than approx 80 characters. So will stick to that.
        Hide
        Tim Hunt added a comment -

        That looks right now. There is also this summary of good commit messages http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html. That says 50 chars for teh first line, but keeping it that short is really hard, if not impossible.

        Forced push is a good way to fix the commits in this sort of situation.

        Show
        Tim Hunt added a comment - That looks right now. There is also this summary of good commit messages http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html . That says 50 chars for teh first line, but keeping it that short is really hard, if not impossible. Forced push is a good way to fix the commits in this sort of situation.
        Hide
        Sam Hemelryk added a comment -

        Thanks guys spot on - this has been integrated now.

        Show
        Sam Hemelryk added a comment - Thanks guys spot on - this has been integrated now.
        Hide
        Rossiani Wijaya added a comment -

        This works great.

        Thanks everyone.

        Test passed.

        Show
        Rossiani Wijaya added a comment - This works great. Thanks everyone. Test passed.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        git repositories have been updated with your awesome changes, thanks! Closing.

        Show
        Eloy Lafuente (stronk7) added a comment - git repositories have been updated with your awesome changes, thanks! Closing.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: