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

          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.
          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
          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...
          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.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: