Moodle
  1. Moodle
  2. MDL-33996

Advanced forum search should display time details in English instead of using time stamps

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2, 2.3
    • Fix Version/s: 2.5
    • Component/s: Forum
    • Testing Instructions:
      Hide
      1. Use the advanced search form and choose a date in "Posts must be newer than this" and/or "Posts must be older than this" field and/or eventually any other conditions.
      2. TEST: If there are some results, you should get a page with the heading "Search results: xx" with the results listed. The search form input field is pre-populated with a string that actually contains all datefrom: forumid: and other parameters (the timestamp is expected here).
      3. TEST: If there are no results, a page with the heading "No posts" is displayed, the advanced search form is displayed again with pre-populated values.
      Show
      Use the advanced search form and choose a date in "Posts must be newer than this" and/or "Posts must be older than this" field and/or eventually any other conditions. TEST: If there are some results, you should get a page with the heading "Search results: xx" with the results listed. The search form input field is pre-populated with a string that actually contains all datefrom: forumid: and other parameters (the timestamp is expected here). TEST: If there are no results, a page with the heading "No posts" is displayed, the advanced search form is displayed again with pre-populated values.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-33996-forum-advanced-timestamp
    • Rank:
      42106

      Description

      If you make a advanced forum search, with time constraints. The query displayed to user is something like:-
      No posts containing 'datefrom:1385827200' were found

      Which clearly wont make any sense to the user.

      The code responsible for this is in mod/forum/search.php

          if (!empty($datefrom)) {
              $search .= ' datefrom:'.$datefrom;
          }
          if (!empty($dateto)) {
              $search .= ' dateto:'.$dateto;
      

        Activity

        Hide
        Mark Johnson added a comment -

        I've written a fix, it creates a separate string containing a human-readable version of the dates, rather than displaying the raw search string.
        https://github.com/marxjohnson/moodle/tree/MDL-33996

        Show
        Mark Johnson added a comment - I've written a fix, it creates a separate string containing a human-readable version of the dates, rather than displaying the raw search string. https://github.com/marxjohnson/moodle/tree/MDL-33996
        Hide
        Mark Johnson added a comment -

        This patch just removes the raw search string from the interface. There's no need to display a message in natural language, as the advanced search form is pre-filled when there are no results.
        https://github.com/marxjohnson/moodle/commit/77f77628b6e1e99e8960f995fb6fd95c23368bd8

        Show
        Mark Johnson added a comment - This patch just removes the raw search string from the interface. There's no need to display a message in natural language, as the advanced search form is pre-filled when there are no results. https://github.com/marxjohnson/moodle/commit/77f77628b6e1e99e8960f995fb6fd95c23368bd8
        Hide
        David Mudrak added a comment -

        After spending some time with Mark here at #mootie13, we finally think that this is a solution that would both fix the issue without too much changes in the code.

        Show
        David Mudrak added a comment - After spending some time with Mark here at #mootie13, we finally think that this is a solution that would both fix the issue without too much changes in the code.
        Hide
        David Mudrak added a comment -

        I just added a single commit on top of Mark's one that removes the string as it is not needed any more.

        Please note that instead of displaying the time format in English (as the issue title suggests), Mark actually fixes this issue by not removing the date information in the title at all. Pretty elegant. Well done Mark!

        Show
        David Mudrak added a comment - I just added a single commit on top of Mark's one that removes the string as it is not needed any more. Please note that instead of displaying the time format in English (as the issue title suggests), Mark actually fixes this issue by not removing the date information in the title at all. Pretty elegant. Well done Mark!
        Hide
        Dan Poltawski added a comment -

        Thanks David and Mark, i've integrated this now!

        Show
        Dan Poltawski added a comment - Thanks David and Mark, i've integrated this now!
        Hide
        Dan Poltawski added a comment -

        Test passed! Thanks a lot David and Mark!

        Show
        Dan Poltawski added a comment - Test passed! Thanks a lot David and Mark!
        Hide
        Damyon Wiese added a comment -

        Thanks for your hard work - this issue has made it! Moodle is now a little bit better.

        Regards, Damyon

        Show
        Damyon Wiese added a comment - Thanks for your hard work - this issue has made it! Moodle is now a little bit better. Regards, Damyon

          People

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

            Dates

            • Created:
              Updated:
              Resolved: