Moodle
  1. Moodle
  2. MDL-29289

Forum rating restrictions by date breaks ability to rate

    Details

    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      18835

      Description

      Choosing to restrict forum ratings by date causes an error as described in this discussion: http://moodle.org/mod/forum/discuss.php?d=175888. The problem is that the code in mod/forum/lib.php that does the date comparison tries to compare against a non-existent column. This defect was introduced with the fix for MDL-26838.

      The line that reads

      if ($info->timecreated < $info->assesstimestart || $info->timecreated > $info->assesstimefinish) {
      

      should be changed to

      if ($info->created < $info->assesstimestart || $info->created > $info->assesstimefinish) {
      

      Searching on "timecreated" will take you directly to the line with the defect.

        Issue Links

          Activity

          Colin Campbell created issue -
          Michael de Raadt made changes -
          Field Original Value New Value
          Link This issue will help resolve MDL-27984 [ MDL-27984 ]
          Michael de Raadt made changes -
          Link This issue is a regression caused by MDL-26838 [ MDL-26838 ]
          Hide
          Michael de Raadt added a comment -

          Thanks for sharing a solution to that.

          Show
          Michael de Raadt added a comment - Thanks for sharing a solution to that.
          Michael de Raadt made changes -
          Fix Version/s STABLE backlog [ 10463 ]
          Priority Minor [ 4 ] Critical [ 2 ]
          Description Choosing to restrict forum ratings by date causes an error as described in this discussion: http://moodle.org/mod/forum/discuss.php?d=175888. The problem is that the code in mod/forum/lib.php that does the date comparison tries to compare against a non-existent column. This defect was introduced with the fix for MDL-26838.

          The line that reads

                  if ($info->timecreated < $info->assesstimestart || $info->timecreated > $info->assesstimefinish) {

          should be changed to

                  if ($info->created < $info->assesstimestart || $info->created > $info->assesstimefinish) {

          Searching on "timecreated" will take you directly to the line with the defect.

          Choosing to restrict forum ratings by date causes an error as described in this discussion: http://moodle.org/mod/forum/discuss.php?d=175888. The problem is that the code in mod/forum/lib.php that does the date comparison tries to compare against a non-existent column. This defect was introduced with the fix for MDL-26838.

          The line that reads

          {code}
          if ($info->timecreated < $info->assesstimestart || $info->timecreated > $info->assesstimefinish) {
          {code}

          should be changed to

          {code}
          if ($info->created < $info->assesstimestart || $info->created > $info->assesstimefinish) {
          {code}

          Searching on "timecreated" will take you directly to the line with the defect.
          Labels patch triaged
          Assignee Martin Dougiamas [ dougiamas ] Andrew Davis [ andyjdavis ]
          Chris Follin made changes -
          Labels patch triaged moodlerooms partner patch triaged
          Hide
          Longfei Yu added a comment -

          Guys,

          I have a question, why the CREATED time should compare to the ASSESSTIMESTART and ASSESSTIMEFINISH? I think it should be the system current time to compare with both of them. If the current time is out of the START and FINISH range, it should give the message "not available". I just do not understand why the CREATED time (which is fixed when you created the forum) should be used to compare?

          Thanks.

          Show
          Longfei Yu added a comment - Guys, I have a question, why the CREATED time should compare to the ASSESSTIMESTART and ASSESSTIMEFINISH? I think it should be the system current time to compare with both of them. If the current time is out of the START and FINISH range, it should give the message "not available". I just do not understand why the CREATED time (which is fixed when you created the forum) should be used to compare? Thanks.
          Hide
          Longfei Yu added a comment -

          Where is my comment?

          Show
          Longfei Yu added a comment - Where is my comment?
          Hide
          Longfei Yu added a comment -

          Should it be

          if (time() < $info->assesstimestart || time() > $info->assesstimefinish) ?

          Thanks.

          Show
          Longfei Yu added a comment - Should it be if (time() < $info->assesstimestart || time() > $info->assesstimefinish) ? Thanks.
          Hide
          Gustavo Heredia added a comment -

          I'm agree with Longfei YU

          Show
          Gustavo Heredia added a comment - I'm agree with Longfei YU
          Andrew Davis made changes -
          Fix Version/s STABLE Sprint 16 [ 11350 ]
          Fix Version/s STABLE backlog [ 10463 ]
          Andrew Davis made changes -
          Status Open [ 1 ] Development in progress [ 3 ]
          Hide
          Andrew Davis added a comment -

          I'll do some more investigating and find out when it was fixed (assuming it was) but I don't seem to be able to reproduce this. Its quite possible this has been fixed in the last few months.

          Which dates assesstimestart and finish should be compared to is an interesting question...

          Show
          Andrew Davis added a comment - I'll do some more investigating and find out when it was fixed (assuming it was) but I don't seem to be able to reproduce this. Its quite possible this has been fixed in the last few months. Which dates assesstimestart and finish should be compared to is an interesting question...
          moodle.com made changes -
          Labels moodlerooms partner patch triaged sprinting
          Michael de Raadt made changes -
          Labels sprinting moodlerooms partner patch sprinting triaged
          Andrew Davis made changes -
          Link This issue has a non-specific relationship to MDL-30580 [ MDL-30580 ]
          Hide
          Andrew Davis added a comment -

          I haven't been able to identify a specific bug however this has definitely been fixed. The function get_item_time_created() in rating/lib.php handles this problem.

          I have raised MDL-30580 to look at what date we use for the rating date restriction.

          Show
          Andrew Davis added a comment - I haven't been able to identify a specific bug however this has definitely been fixed. The function get_item_time_created() in rating/lib.php handles this problem. I have raised MDL-30580 to look at what date we use for the rating date restriction.
          Andrew Davis made changes -
          Status Development in progress [ 3 ] Closed [ 6 ]
          Fix Version/s STABLE Sprint 16 [ 11350 ]
          Resolution Won't Fix [ 2 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: