Commit 5b12f475 authored by Penny Leach's avatar Penny Leach
Browse files

Merge with /media/usbdisk/nemrepo/

parents 2f657fa8 bfb14490
......@@ -41,7 +41,7 @@ $userid = $USER->get('id');
if (empty($owned)) { // just get communities this user is a member of.
$data = get_member_communities($userid, $offset, $limit);
$count = get_record_sql('SELECT COUNT(c.id) AS count
$count = get_record_sql('SELECT COUNT(distinct c.id) AS count
FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'community_member cm ON cm.community = c.id
WHERE c.owner != ? AND cm.member = ?', array($userid, $userid));
......@@ -52,7 +52,7 @@ else {
$count = count_records_sql('SELECT COUNT(*) FROM ' . $prefix . 'community c WHERE c.owner = ?',
array($userid));
$datasql = 'SELECT c.id,c.jointype,c.name,c.owner,count(cmr.community) as requestcount, COUNT(v.view) AS hasviews
$datasql = 'SELECT c.id,c.jointype,c.name,c.owner,count(distinct cmr.community) as requestcount, COUNT(distinct v.view) AS hasviews
FROM ' . $prefix . 'community c
LEFT JOIN ' . $prefix . 'community_member_request cmr ON cmr.community = c.id
LEFT JOIN ' . $prefix . 'view_access_community v ON v.community = c.id
......
......@@ -56,7 +56,7 @@ switch ($type) {
$where = 'WHERE v.submittedto = ?';
$values = array($id);
if (!$submitted) {
$where .= 'OR (
$where .= ' OR (
a.community = ?
AND ( v.startdate IS NULL OR v.startdate < ? )
AND ( v.stopdate IS NULL OR v.stopdate > ? )
......@@ -71,7 +71,7 @@ switch ($type) {
}
$count = count_records_sql('
SELECT COUNT(v.id)
SELECT COUNT(id)
FROM ' . $prefix . 'view v
LEFT OUTER JOIN ' . $prefix . 'view_access_community a ON a.view=v.id
' . $where,
......
......@@ -161,7 +161,7 @@ class PluginSearchInternal extends PluginSearch {
$count = get_field_sql('
SELECT
COUNT(DISTINCT u.id)
COUNT(DISTINCT owner)
FROM
' . $prefix . 'usr u
LEFT JOIN ' . $prefix . 'artefact a ON u.id=a.owner
......@@ -185,7 +185,7 @@ class PluginSearchInternal extends PluginSearch {
if ($count > 0) {
$data = get_records_sql_array('
SELECT DISTINCT ON (u.firstname, u.lastname, u.id)
SELECT DISTINCT
u.id, u.username, u.institution, u.firstname, u.lastname, u.preferredname, u.email, u.staff
FROM ' . $prefix . 'artefact a
INNER JOIN ' . $prefix .'usr u ON u.id = a.owner
......
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