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

block_online_users.php calculation in front page

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Component/s: Blocks
    • Labels:
      None
    • Environment:
      All
    • Database:
      Any
    • Affected Branches:
      MOODLE_14_STABLE

      Description

      calculation for time since last activity (bubble) is incorrect when in the frontpage because timeaccess field is related to courses.

      the fix is to include users.lastaccess and subtract that from time()

      I attach a diff -c patch

      Index: block_online_users.php

      ===================================================================

      RCS file: /cvsroot/moodle/moodle/blocks/online_users/block_online_users.php,v

      retrieving revision 1.8.2.1

      diff -r1.8.2.1 block_online_users.php

      76c76

      < $students = get_records_sql(SELECT u.id, u.username, u.firstname, u.lastname, u.picture, s.timeaccess

      > $students = get_records_sql(SELECT u.id, u.username, u.firstname, u.lastname, u.picture, s.timeaccess, u.lastaccess

      83c83

      < $teachers = get_records_sql(SELECT u.id, u.username, u.firstname, u.lastname, u.picture, s.timeaccess

      > $teachers = get_records_sql(SELECT u.id, u.username, u.firstname, u.lastname, u.picture, s.timeaccess, u.lastaccess

      117c117,118

      < $timeago = format_time(time() - $user->timeaccess);

      > #$timeago = format_time(time() - $user->timeaccess);

      > $timeago = format_time(time() - ($user->timeaccess?$user->timeaccess:$user->lastaccess)); //bruno to calculate correctly on frontpage

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: