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

enhancement to assign::submissions_open

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3, 2.3.3
    • Fix Version/s: 2.4.1
    • Component/s: Assignment
    • Labels:

      Description

      The submissions_open method in the assign class is currently private. It also depends on the global $USER, with no way to invoke it for a user other than the current global $USER.

      We need to be able to check whether submissions are open for a particular user for a particular assignment as part of a plugin we are considering developing, so it would be nice if this function were public and general, rather than private and specific. We could then use this method, rather than rewriting the same functionality ourselves.

      Suggested implementation:

      1) Make submissions_open take an optional $userid parameter (default: 0).
      2) Default to using the current $USER if $userid is 0.
      3) Change submissions_open to be public rather than private.

      No changes to calling code are required, as the previous behaviour (no arguments, use $USER) remains supported.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            djh daniel hyde added a comment -

            This patch implements the "suggested implementation" and applies cleanly against MOODLE_23_STABLE

            Show
            djh daniel hyde added a comment - This patch implements the "suggested implementation" and applies cleanly against MOODLE_23_STABLE
            Hide
            damyon Damyon Wiese added a comment -

            Thanks for reporting this issue,

            In 2.4 the userid parameter has already been added to that function, but it is still private. I updated the patch to apply cleanly to 2.4 master.

            Show
            damyon Damyon Wiese added a comment - Thanks for reporting this issue, In 2.4 the userid parameter has already been added to that function, but it is still private. I updated the patch to apply cleanly to 2.4 master.
            Hide
            poltawski Dan Poltawski added a comment -

            Technically we do not allow improvements in the stable branches.

            But we are a little bit flexible around a new major release and this seems not too dangerous and a benefit to plugin authors. So i've integrated this to 24 and master. Thanks!

            Show
            poltawski Dan Poltawski added a comment - Technically we do not allow improvements in the stable branches. But we are a little bit flexible around a new major release and this seems not too dangerous and a benefit to plugin authors. So i've integrated this to 24 and master. Thanks!
            Hide
            salvetore Michael de Raadt added a comment - - edited

            Test result: Like taking candy from a baby.

            (Note: I did confirm that testing was not really required on this. There are unit tests incoming for this functionality and Damyon has tested this from code.)

            Show
            salvetore Michael de Raadt added a comment - - edited Test result: Like taking candy from a baby. (Note: I did confirm that testing was not really required on this. There are unit tests incoming for this functionality and Damyon has tested this from code.)
            Hide
            poltawski Dan Poltawski added a comment -

            Sorry, should've passed that one!

            Show
            poltawski Dan Poltawski added a comment - Sorry, should've passed that one!
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now!

            Closing, ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now! Closing, ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jan/13