Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

correcting an issue with the attending list not showing

  • Loading branch information...
commit 26d7b9b1c7f72fbcdfb542cc5b7b96adf399f908 1 parent c8114bd
@lornajane lornajane authored
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/api-v2/models/EventMapper.php
View
15 src/api-v2/models/EventMapper.php
@@ -108,15 +108,9 @@ protected function getEvents($resultsperpage, $start, $where = null, $order = nu
WHEN (((events.event_start - 3600*24) < '.mktime(0,0,0).') and (events.event_start + (3*30*3600*24)) > '.mktime(0,0,0).') THEN 1
ELSE 0
END as comments_enabled, '
- . 'current_ua.uid as attending '
+ . '0 as attending '
. 'from events '
- . 'left join user_attend current_ua on (current_ua.eid = events.ID and current_ua.uid ';
- if(isset($this->_request->user_id)) {
- $sql .= ' = ' . $this->_request->user_id;
- } else {
- $sql .= ' is null';
- }
- $sql .= ') ';
+ . 'left join user_attend current_ua on (current_ua.eid = events.ID)';
$sql .= 'where active = 1 and '
. '(pending = 0 or pending is NULL) and '
. 'private <> "y" ';
@@ -126,6 +120,9 @@ protected function getEvents($resultsperpage, $start, $where = null, $order = nu
$sql .= ' and ' . $where;
}
+ // group by for the multiple attending recipes; only ever want to see each event once
+ $sql .= 'group by events.ID ';
+
// order by
if ($order) {
$sql .= ' order by ' . $order;
@@ -367,7 +364,7 @@ protected function getTags($event_id)
*/
public function getEventsAttendedByUser($user_id, $resultsperpage, $start, $verbose = false)
{
- $where = ' ua.uid = ' . (int)$user_id;
+ $where = ' current_ua.uid = ' . (int)$user_id;
$order = ' events.event_start desc ';
$results = $this->getEvents($resultsperpage, $start, $where, $order);
if (is_array($results)) {
Please sign in to comment.
Something went wrong with that request. Please try again.