Repository :
http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
---------------------------------------------------------------
commit f9be80d297c29934689480b2418aad8c50aa2f95
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Mon Dec 10 20:33:13 2012 +0100
Add methods to check for the availability of a time slot over a given time period
This is necessary for recursive meeting where we need to make sure that there is not
a
meeting later in the recursion (ie: in 3 months) that will happen at the same time as
this
one.
---------------------------------------------------------------
fedocal/fedocallib/model.py | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 82a00c3..5404be5 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -316,6 +316,19 @@ class Meeting(BASE):
(Meeting.meeting_time_stop < stop_time)).all()
@classmethod
+ def get_in_future_by_time(cls, session, calendar, meetingdate,
+ recursion_ends, start_time, stop_time):
+ """ Retrieve the list of meetings for a given date and between
+ two times for a specific calendar.
+ """
+ return session.query(cls).filter(and_
+ (Meeting.calendar == calendar),
+ (Meeting.meeting_date >= meetingdate),
+ (Meeting.meeting_date <= recursion_ends),
+ (Meeting.meeting_time_start >= start_time),
+ (Meeting.meeting_time_stop < stop_time)).all()
+
+ @classmethod
def at_time(cls, session, calendar, meetingdate, t_time):
""" Returns the meeting occuring at this specifict time point.
"""
@@ -326,6 +339,19 @@ class Meeting(BASE):
(Meeting.meeting_time_stop > t_time)).all()
@classmethod
+ def in_future_at_time(cls, session, calendar, meetingdate,
+ recursion_ends, t_time):
+ """ Returns the meeting occuring at this specifict time point
+ at any time in the future.
+ """
+ return session.query(cls).filter(and_
+ (Meeting.calendar == calendar),
+ (Meeting.meeting_date >= meetingdate),
+ (Meeting.meeting_date <= recursion_ends),
+ (Meeting.meeting_time_start <= t_time),
+ (Meeting.meeting_time_stop > t_time)).all()
+
+ @classmethod
def get_past_meeting_of_user(cls, session, username, start_date):
""" Retrieve the list of meetings which specified username
is among the managers and which date is older than the specified