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

Course Overview report-Weighted stats incorrect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.4
    • Fix Version/s: 2.0.1
    • Component/s: Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      the sql for STATS_REPORT_ACTIVE_COURSES_WEIGHTED in lib/statslib.php returns multiple records for the same courseid which Moodle strips via the standard db functions (only the first row is kept) as the first value in a query should be unique

      this happens as a result of this part of the query:
      SELECT courseid, (stat1+stat2) AS all_activity
      FROM '.$CFG->prefix.'stats_'.$param->table.'
      WHERE stattype=\'activity\' AND timeend >= '.$param->timeafter.' AND roleid = 0

      shouldn't this be:
      SELECT courseid, sum(stat1+stat2) AS all_activity
      FROM '.$CFG->prefix.'stats_'.$param->table.'
      WHERE stattype=\'activity\' AND timeend >= '.$param->timeafter.' AND roleid = 0 GROUP BY courseid

        Attachments

          Activity

            People

            • Assignee:
              danmarsden Dan Marsden
              Reporter:
              danmarsden Dan Marsden
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Dec/10