1.1 --- a/imiptools/handlers/scheduling.py Tue Oct 27 18:44:26 2015 +0100
1.2 +++ b/imiptools/handlers/scheduling.py Tue Oct 27 18:46:48 2015 +0100
1.3 @@ -19,8 +19,9 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 +from imiptools.data import uri_values
1.8 from imiptools.dates import ValidityError, to_timezone
1.9 -from imiptools.period import invert_freebusy, periods_from
1.10 +from imiptools.period import get_common_periods, invert_freebusy, periods_from
1.11
1.12 def schedule_in_freebusy(handler):
1.13
1.14 @@ -97,9 +98,17 @@
1.15 return scheduled
1.16
1.17 # Find free periods, update the object with the details.
1.18 + # There should already be free/busy information for the user.
1.19
1.20 - freebusy = handler.store.get_freebusy(handler.user)
1.21 - free = invert_freebusy(freebusy)
1.22 + all_free = [invert_freebusy(handler.store.get_freebusy(handler.user))]
1.23 +
1.24 + for attendee in uri_values(handler.obj.get_values("ATTENDEE")):
1.25 + if attendee != handler.user:
1.26 + freebusy = handler.store.get_freebusy_for_other(handler.user, attendee)
1.27 + if freebusy:
1.28 + all_free.append(invert_freebusy(freebusy))
1.29 +
1.30 + free = get_common_periods(all_free)
1.31 permitted_values = handler.get_permitted_values()
1.32 periods = []
1.33