Commit 619d46a5 authored by Andrew Robert Nicols's avatar Andrew Robert Nicols
Browse files

Ensure ordering of unused views and improve performance of query.

Unused views weren't being sorted so I've opted to sort them by view title

I also notice that the query was using a subselect so I've changed this to
a join to improve efficiency of the query.
Signed-off-by: default avatarAndrew Robert Nicols <>
parent ec8fd70d
......@@ -275,12 +275,13 @@ class Collection {
$userid = $USER->get('id');
($views = get_records_sql_array("SELECT, v.title
FROM {view} v
WHERE v.owner = ? AND v.type NOT IN ('dashboard','grouphomepage','profile')
SELECT cv.view
FROM {collection_view} cv
GROUP BY, v.title", array($userid)))
LEFT JOIN {collection_view} cv ON cv.view =
WHERE v.owner = ?
AND cv.view IS NULL
AND v.type NOT IN ('dashboard','grouphomepage','profile')
GROUP BY, v.title
ORDER BY v.title ASC
", array($userid)))
|| ($views = array());
return $views;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment