Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-51888

Refinements to mod_resource option to display uploaded date

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0
    • Resource
    • MOODLE_30_STABLE
    • MOODLE_30_STABLE
    • wip-MDL-51888-master
    • Hide

      Functionality is pretty much tested by behat.

      Performance test:
      We need to make sure that resource_get_optional_details() does not do anything costly (performs no db queries) when displaying the course page.

      1. hack resource_get_optional_details() and echo some "NONONO" output inside this method before it calls resource_get_file_details() - this is the only part where it can access db
      2. create several resources with different display options - not displaying any information, displaying only size, only date, several options, etc.
      3. browse course page and make sure that "NONONO" never appears
      4. look at course page in the different language, or as a user in different timezone. Make sure the date is localised (please note that "Uploaded" string is not yet translated)
      5. Wait until it is at least 5 minutes later than file uploaded date and then replace the file with another one
      6. Make sure now the date is displayed as "Modified ..." and not "Uploaded ..."

      Functionality test:

      1. leave the same hack
      2. add a file to your private files or any other repo where you can create shortcut to
      3. create a file resource with a shortcut to this file, select to display file type
      4. make sure "NONONO" is not displayed when you browse course
      5. change settings to display size and/or modified date
      6. make sure "NONONO" IS displayed when you browse course
      7. update the original file
      8. make sure the new size is displayed. Note the timemodified is not synced, I created MDL-51985 for it.
      Show
      Functionality is pretty much tested by behat. Performance test: We need to make sure that resource_get_optional_details() does not do anything costly (performs no db queries) when displaying the course page. hack resource_get_optional_details() and echo some "NONONO" output inside this method before it calls resource_get_file_details() - this is the only part where it can access db create several resources with different display options - not displaying any information, displaying only size, only date, several options, etc. browse course page and make sure that "NONONO" never appears look at course page in the different language, or as a user in different timezone. Make sure the date is localised (please note that "Uploaded" string is not yet translated) Wait until it is at least 5 minutes later than file uploaded date and then replace the file with another one Make sure now the date is displayed as "Modified ..." and not "Uploaded ..." Functionality test: leave the same hack add a file to your private files or any other repo where you can create shortcut to create a file resource with a shortcut to this file, select to display file type make sure "NONONO" is not displayed when you browse course change settings to display size and/or modified date make sure "NONONO" IS displayed when you browse course update the original file make sure the new size is displayed. Note the timemodified is not synced, I created MDL-51985 for it.

    Description

      Basically a follow on from MDL-40836 because we wanted it landed

      1. The behat tests need making more robust/not gonna break in 2016

        And I <seedate> see "2015" in the ".activity.resource .resourcelinkdetails" "css_element"

      2. I think that we should shorten the date string and check with marycooch and tsala for advice about the wording (I wasn't sure about the word 'on' in 'Uploaded on Friday, 23 October 2015, 6:07 am'). This was my shortened date string, maybe we just want the date and not the time:

        diff --git a/mod/resource/locallib.php b/mod/resource/locallib.php
        index e705f95..8e939b7 100644
        --- a/mod/resource/locallib.php
        +++ b/mod/resource/locallib.php
        @@ -326,9 +326,9 @@ function resource_get_optional_details($resource, $cm) {
                     $modifieddate = $mainfile->get_timemodified();
         
                     if ($modifieddate > $uploaddate) {
        -                $date = get_string('modifieddate', 'mod_resource', userdate($modifieddate));
        +                $date = get_string('modifieddate', 'mod_resource', userdate($modifieddate, get_string('strftimedatetimeshort', 'langconfig')));
                     } else {
        -                $date = get_string('uploadeddate', 'mod_resource', userdate($uploaddate));
        +                $date = get_string('uploadeddate', 'mod_resource', userdate($uploaddate, get_string('strftimedatetimeshort', 'langconfig')));
                     }
                     $langstring .= 'date';
                     $infodisplayed += 1;
        

      3. Marina's localisation/caching fix might need new issue for backporting creating.

      Attachments

        Issue Links

          Activity

            People

              marina Marina Glancy
              poltawski Dan Poltawski
              Simey Lameze Simey Lameze
              Andrew Lyons Andrew Lyons
              Jun Pataleta Jun Pataleta
              Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                16/Nov/15