Issue Details (XML | Word | Printable)

Key: MDL-12898
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Mathieu Petit-Clair
Reporter: Eloy Lafuente (stronk7)
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-13404

Correlation tags SQL is missing one condition....

Created: 10/Jan/08 04:56 AM   Updated: 22/Feb/08 07:36 PM
Return to search
Component/s: Tags
Affects Version/s: 1.9, 2.0
Fix Version/s: 1.9, 2.0

Database: Any
Participants: Eloy Lafuente (stronk7) and Mathieu Petit-Clair
Security Level: None
Resolved date: 22/Feb/08
Affected Branches: MOODLE_19_STABLE, MOODLE_20_STABLE
Fixed Branches: MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
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 :-)

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
No commits have yet been performed on this issue.