Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-13404 Improve tagging system
  3. MDL-12898

Correlation tags SQL is missing one condition....

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.9, 2.0
    • 1.9, 2.0
    • Tags
    • None
    • Any
    • MOODLE_19_STABLE, MOODLE_20_STABLE
    • MOODLE_19_STABLE, MOODLE_20_STABLE

      I was looking code due to MDL-12897 when, in cache_correlated_tags(), this query:

      $query = "SELECT tb.tagid , COUNT nr
      FROM {$CFG->prefix}tag_instance ta
      INNER JOIN {$CFG->prefix}tag_instance tb ON ta.itemid = tb.itemid
      WHERE ta.tagid = {$tag_id}
      GROUP BY tb.tagid
      ORDER BY nr DESC";

      seems to be missing one extra condition, in order to compare only same itemtype tags (or else we'll be counting unrelated items), so this join seems necessary:

      INNER JOIN {$CFG->prefix}tag_instance tb ON ta.itemid = tb.itemid AND ta.itemtype = tb.itemtype

      instead of the current one.

      Ciao

            scyrma Mathieu Petit-Clair
            stronk7 Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.