Add-ons
  1. Add-ons
  2. CONTRIB-3362

Adobeconnect default start/end times not being correctly calculated

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.16
    • Fix Version/s: 1.9.16, 2.0.2
    • Component/s: Module: Adobeconnect
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      37914

      Description

      Description of the issue
      ---------------------------------------------------------------------------------
      The default end time for an adobe connect activity could default to a time before the start time, which means that it will throw a validation error if you try to add the activity with the default values supplied.

      Steps to reproduce
      ---------------------------------------------------------------------------------
      1. Go to: Site Administration > Location > Location Settings and set "Default timezone" to something other than "Server's local time" (e.g. UTC+3)
      2. Add an Adobe Connect activity to a course site, and see that the default end time is not two hours after the start time, as expected (e.g. it is 1 hour before)

      Expected Behaviour
      ---------------------------------------------------------------------------------
      Default end time should be default start time + 2 hours

      Resolution
      ---------------------------------------------------------------------------------
      Patch attached

      Patch and github repo
      ---------------------------------------------------------------------------------
      Links to be provided in comments section once I get a tracker number for this issue

        Activity

        Jennifer Edmondson created issue -
        Hide
        Jennifer Edmondson added a comment - - edited

        Patch details (CONTRIB-3362-default-end-time.patch)
        ---------------------------------------------------------------------------------
        This patch fixes the default end time for Adobe Connect activities
        Moodle version: 2007101591.08
        Moodle release: 1.9.15+ (Build: 20111205)
        adobeconnect module version: 2011072100

        Git Repo
        ---------------------------------------------------------------------------------
        https://github.com/jamedmondson/moodle-mod_adobeconnect/tree/CONTRIB-3362-default-end-time_19_STABLE

        Show
        Jennifer Edmondson added a comment - - edited Patch details ( CONTRIB-3362 -default-end-time.patch) --------------------------------------------------------------------------------- This patch fixes the default end time for Adobe Connect activities Moodle version: 2007101591.08 Moodle release: 1.9.15+ (Build: 20111205) adobeconnect module version: 2011072100 Git Repo --------------------------------------------------------------------------------- https://github.com/jamedmondson/moodle-mod_adobeconnect/tree/CONTRIB-3362-default-end-time_19_STABLE
        Jennifer Edmondson made changes -
        Field Original Value New Value
        Attachment CONTRIB-3362_19_STABLE-before-patch.png [ 26471 ]
        Attachment CONTRIB-3362_19_STABLE--after-patch.png [ 26472 ]
        Attachment CONTRIB-3362-default-end-time.patch [ 26473 ]
        Hide
        Akin Delamarre added a comment -

        Thanks for the bug report. Looking at the changes, I find it odd that that the steps you posted cause the error. Seeing that the code generates the end time 2 hours after the start time (as defined in the PHP function documentation).

        The same code exists in the 2.0 version of the module. So this technically should be a bug with the 2.0 version as well.

        Show
        Akin Delamarre added a comment - Thanks for the bug report. Looking at the changes, I find it odd that that the steps you posted cause the error. Seeing that the code generates the end time 2 hours after the start time (as defined in the PHP function documentation). The same code exists in the 2.0 version of the module. So this technically should be a bug with the 2.0 version as well.
        Hide
        Jennifer Edmondson added a comment -

        Hi,

        I think the problem is that the code is calling usertime() on the default end time.

        mod_form.php adds a starttime element and an endtime element (type: date_time_selector) but it doesn't set a default starttime. Moodle's form libs automatically handle converting this type of element to the system/user's local time, so this start time always shows the correct current time for the system/user if you don't pass it a default value.

        mod_form.php does, however, set a default endtime, which is calculated from a time that has had usertime() applied to it. As the forms lib is already set up to handle this conversion, I believe this results in the time being converted twice, hence the behaviour I have described.

        You are correct that the code generates the end time 2 hours after the start time as defined in the PHP function documentation, but the start time it is adding time to ($starttime) is incorrect. I imagine that if you added a line that set the form's default start time to $starttime then the default start and end times would be 2 hours apart... but they wouldn't match the user/system's current time.

        The reason that the steps I provided reproduce this behaviour is that when your default timezone is set to the server's local time then calling usertime($time) has no effect, so it doesn't matter if it is applied once or twice to a value

        Show
        Jennifer Edmondson added a comment - Hi, I think the problem is that the code is calling usertime() on the default end time. mod_form.php adds a starttime element and an endtime element (type: date_time_selector) but it doesn't set a default starttime. Moodle's form libs automatically handle converting this type of element to the system/user's local time, so this start time always shows the correct current time for the system/user if you don't pass it a default value. mod_form.php does, however, set a default endtime, which is calculated from a time that has had usertime() applied to it. As the forms lib is already set up to handle this conversion, I believe this results in the time being converted twice, hence the behaviour I have described. You are correct that the code generates the end time 2 hours after the start time as defined in the PHP function documentation, but the start time it is adding time to ($starttime) is incorrect. I imagine that if you added a line that set the form's default start time to $starttime then the default start and end times would be 2 hours apart... but they wouldn't match the user/system's current time. The reason that the steps I provided reproduce this behaviour is that when your default timezone is set to the server's local time then calling usertime($time) has no effect, so it doesn't matter if it is applied once or twice to a value
        Hide
        Akin Delamarre added a comment -

        Fixed. Thanks for the patch

        Show
        Akin Delamarre added a comment - Fixed. Thanks for the patch
        Akin Delamarre made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.2 [ 10455 ]
        Fix Version/s 1.9.16 [ 11453 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development