Moodle
  1. Moodle
  2. MDL-25275

database activity, date fields: impossible to avoid searching by them

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.3.2
    • Fix Version/s: 2.2.6, 2.3.3
    • Labels:
      None
    • Database:
      Any
    • Testing Instructions:
      Hide
      1. Create a database activity.
      2. Add some fields, one of which is a date field.
      3. Add the date field into the 'Advanced search template' (make sure to save the templates for the single and list sections).
      4. Add data into the database, some with different dates.
      5. Click on the Search tab.
      6. Save settings with "Use this date in the search?" un-ticked.
        All of the entries should be displayed
      7. Tick the "Use this date in the search?" box.
        The search should now be limited to entries with that specific date
      Show
      Create a database activity. Add some fields, one of which is a date field. Add the date field into the 'Advanced search template' (make sure to save the templates for the single and list sections). Add data into the database, some with different dates. Click on the Search tab. Save settings with "Use this date in the search?" un-ticked. All of the entries should be displayed Tick the "Use this date in the search?" box. The search should now be limited to entries with that specific date
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-25275-master
    • Rank:
      1557

      Description

      While doing various fixes related to MDL-21437, in order to get the database module working ok under mssql/oracle DBs, this problem has been revealed:

      1) Create one database activity
      2) Add some fields to them, on pupose add one "date" field.
      3) Fill some records.
      4) Go to the advanced search tab

      Current behavior:

      • The date field appears in the advanced search, filled with current date, and it is impossible to take it out from the search.

      Expected behavior:

      • Near to de the DD/MM/YYYY field should be one checkbox to control if the search must include the date or no, defaulting to no (unchecked and DD/MM/YYYY disabled).

      Known workaround:

      • Edit the advanced search template and take out any date field. Imperfect because then the activity cannot be searched by date fields, but at least doesn't break all the searches.

      Ciao

        Issue Links

          Activity

          Hide
          Mark Nelson added a comment - - edited

          [?] Syntax
          [Y] Output
          [Y] Whitespace
          [Y] Language
          [-] Databases
          [Y] Testing
          [-] Security
          [-] Documentation
          [Y] Git
          [Y] Sanity check

          Hi Adrian,

          Patch looks good. There are a few current issues that only exist due to the previous code (not your fault) -

          • The return statement in the function display_search_field has only 3 spaces for it's indentation, instead of 4.
          • I would also separate the return statement by a line from the other logic.
          • Remove the comment to 'print_date_selector', it is deprecated anyways.
          • Unneeded empty first line for the function parse_search_field.
          • The 'else' in parse_search_field should be brought up to the next line.
          Show
          Mark Nelson added a comment - - edited [?] Syntax [Y] Output [Y] Whitespace [Y] Language [-] Databases [Y] Testing [-] Security [-] Documentation [Y] Git [Y] Sanity check Hi Adrian, Patch looks good. There are a few current issues that only exist due to the previous code (not your fault) - The return statement in the function display_search_field has only 3 spaces for it's indentation, instead of 4. I would also separate the return statement by a line from the other logic. Remove the comment to 'print_date_selector', it is deprecated anyways. Unneeded empty first line for the function parse_search_field. The 'else' in parse_search_field should be brought up to the next line.
          Hide
          Adrian Greeve added a comment -

          Thanks Mark,

          I've made all the changes that you suggested.

          Submitting for integration.

          Show
          Adrian Greeve added a comment - Thanks Mark, I've made all the changes that you suggested. Submitting for integration.
          Hide
          Mark Nelson added a comment -

          Hi Adrian, nice work! The file is looking much better now. However, you removed the space between the global variable and the logic in the function update_content. There is usually a line space separating the global variables from the code.

          Show
          Mark Nelson added a comment - Hi Adrian, nice work! The file is looking much better now. However, you removed the space between the global variable and the logic in the function update_content. There is usually a line space separating the global variables from the code.
          Hide
          Adrian Greeve added a comment -

          Thanks Mark,

          I don't know what drugs I was on when I removed that line.

          Tidied up and uploaded.

          Show
          Adrian Greeve added a comment - Thanks Mark, I don't know what drugs I was on when I removed that line. Tidied up and uploaded.
          Hide
          Sam Hemelryk added a comment -

          Thanks Adrian, this has been integrated now.

          Show
          Sam Hemelryk added a comment - Thanks Adrian, this has been integrated now.
          Hide
          Rossiani Wijaya added a comment -

          Testing this in 2.2, 2.3 and 2.4.

          It works as expected.

          Test passed.

          Show
          Rossiani Wijaya added a comment - Testing this in 2.2, 2.3 and 2.4. It works as expected. Test passed.
          Hide
          Aparup Banerjee added a comment -

          Your issue has dug up some gold.
          It works great i've been told.
          Go forth, be brave, be bold.

          yay! "All your thoughts are belong to everyone."

          Thanks and ciao!

          Show
          Aparup Banerjee added a comment - Your issue has dug up some gold. It works great i've been told. Go forth, be brave, be bold. yay! "All your thoughts are belong to everyone." Thanks and ciao!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: