[CalendarServer-changes] [13552] CalendarServer/trunk/txdav/who/groups.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed May 28 18:22:33 PDT 2014
Revision: 13552
http://trac.calendarserver.org//changeset/13552
Author: sagen at apple.com
Date: 2014-05-28 18:22:33 -0700 (Wed, 28 May 2014)
Log Message:
-----------
Fix the group attendee query
Modified Paths:
--------------
CalendarServer/trunk/txdav/who/groups.py
Modified: CalendarServer/trunk/txdav/who/groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/groups.py 2014-05-28 19:54:11 UTC (rev 13551)
+++ CalendarServer/trunk/txdav/who/groups.py 2014-05-29 01:22:33 UTC (rev 13552)
@@ -393,24 +393,24 @@
attendeeGroupUIDs = set()
- # get all groups from events
+ # Get groupUIDs for aoo group attendees
+ # FIXME: this query does not have a unit test!
groupAttendee = schema.GROUP_ATTENDEE
+ gr = schema.GROUPS
rows = yield Select(
- [groupAttendee.GROUP_ID, ],
- From=groupAttendee,
+ [gr.GROUP_UID],
+ From=gr,
+ Distinct=True,
+ Where=gr.GROUP_ID.In(
+ Select(
+ [groupAttendee.GROUP_ID],
+ From=groupAttendee,
+ Distinct=True
+ )
+ )
).on(txn)
- groupIDs = set([row[0] for row in rows])
+ attendeeGroupUIDs = set([row[0] for row in rows])
- # get groupUIDs
- if groupIDs:
- gr = schema.GROUPS
- rows = yield Select(
- [gr.GROUP_UID, ],
- From=gr,
- Where=gr.GROUP_ID.In(groupIDs)
- ).on(txn)
- attendeeGroupUIDs = set([row[0] for row in rows])
-
# FIXME: is this a good place to clear out unreferenced groups?
returnValue(delegatedUIDs.union(attendeeGroupUIDs))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140528/6ecd38e4/attachment.html>
More information about the calendarserver-changes
mailing list