Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit a5808cfcec37b2341b25d91bcf098c00e0e1dab5
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sun Nov 4 17:04:35 2012 +0100
Add some documentation to the functions.
>---------------------------------------------------------------
fedocal/tests/test_fedocallib.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/fedocal/tests/test_fedocallib.py b/fedocal/tests/test_fedocallib.py
index e07c64c..f55e115 100644
--- a/fedocal/tests/test_fedocallib.py
+++ b/fedocal/tests/test_fedocallib.py
@@ -78,18 +78,23 @@ class Fedocallibtests(Modeltests):
""" Fedocallib tests. """
def __setup_calendar(self):
+ """ Set up basic calendar information. """
from test_calendar import Calendartests
cal = Calendartests('test_init_calendar')
cal.session = self.session
cal.test_init_calendar()
def __setup_meeting(self):
+ """ Set up basic calendar information and add some meetings in
+ them. """
from test_meeting import Meetingtests
meeting = Meetingtests('test_init_meeting')
meeting.session = self.session
meeting.test_init_meeting()
def __setup_meeting_today(self):
+ """ Set up basic calendar information and add some meetings in
+ them (at the date of today). """
import test_meeting
test_meeting.TODAY = date.today()
self.__setup_meeting()
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit ac9a8df366f31fc8a8fef40711d1f54aa93b73a6
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sun Nov 4 16:42:07 2012 +0100
Rename and put a full path for the default DB in the sample config file
>---------------------------------------------------------------
fedocal/fedocal.cfg.sample | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocal.cfg.sample b/fedocal/fedocal.cfg.sample
index 4bd9672..8893e9e 100644
--- a/fedocal/fedocal.cfg.sample
+++ b/fedocal/fedocal.cfg.sample
@@ -4,6 +4,6 @@ secret_key=<The web application secret key>
# url to the database server:
;db_url=mysql://user:pass@host/db_name
;db_url=postgres://user:pass@host/db_name
-db_url=sqlite:///db_dev
+db_url=sqlite:////tmp/fedocal_dev.sqlite
# The FAS group in which the admin of fedocal are
admin_group=fedocal_admin
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit f6f0c2b464fbdb44dbd5fb566ae45ff8312c0d21
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sun Nov 4 16:27:26 2012 +0100
Fix unit-tests
From now on, the get_active_regular_meeting requires a complete
time frame (defaults to 7 days).
This change impacts the Week object which has been adjusted for it.
The other unit-tests have been fixed as well
>---------------------------------------------------------------
fedocal/fedocallib/model.py | 11 +++++++----
fedocal/fedocallib/week.py | 2 +-
fedocal/tests/test_fedocallib.py | 28 ++++++++++++++++------------
fedocal/tests/test_week.py | 2 +-
4 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 60038c4..66ae53a 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -19,6 +19,7 @@ import pkg_resources
from datetime import datetime
from datetime import date
+from datetime import timedelta
from sqlalchemy import (
Boolean,
@@ -265,11 +266,13 @@ class Meeting(BASE):
(Meeting.meeting_date < stop_date)).all()
@classmethod
- def get_active_regular_meeting(cls, session, end_date):
+ def get_active_regular_meeting(cls, session, start_date, end_date):
""" Retrieve the list of meetings with a recursion which
- end_date is not past the provided end_date.
+ end_date is not past the provided end_date and starting before
+ the end of the time considered.
"""
meetings = session.query(cls).filter(and_
+ (Meeting.meeting_date <= end_date),
(Meeting.recursion_ends >= end_date),
(Meeting.recursion_frequency != None)
).order_by(Meeting.meeting_date).all()
@@ -323,13 +326,13 @@ class Meeting(BASE):
@classmethod
def get_future_regular_meeting_of_user(cls, session, username,
- end_date=date.today()):
+ start_date=date.today()):
""" Retrieve the list of meetings which specified username
is among the managers and which end date is older or egual to
specified one (which by default is today).
"""
meetings = session.query(cls).filter(and_
- (Meeting.recursion_ends >= end_date),
+ (Meeting.recursion_ends >= start_date),
(Meeting.recursion_frequency != None),
(Meeting.meeting_manager.like('%%%s%%' % username))
).order_by(Meeting.meeting_date).all()
diff --git a/fedocal/fedocallib/week.py b/fedocal/fedocallib/week.py
index 6e8fa21..399e6d1 100644
--- a/fedocal/fedocallib/week.py
+++ b/fedocal/fedocallib/week.py
@@ -43,7 +43,7 @@ class Week(object):
self.start_date, self.stop_date)
for meeting in Meeting.get_active_regular_meeting(self.session,
- self.start_date):
+ self.start_date, self.stop_date):
for delta in range(0, 7):
day = self.start_date + timedelta(days=delta)
if ((meeting.meeting_date - day).days %
diff --git a/fedocal/tests/test_fedocallib.py b/fedocal/tests/test_fedocallib.py
index 91f0079..5e29168 100644
--- a/fedocal/tests/test_fedocallib.py
+++ b/fedocal/tests/test_fedocallib.py
@@ -154,14 +154,14 @@ class Fedocallibtests(Modeltests):
self.assertEqual(week.calendar.calendar_name, 'test_calendar')
self.assertNotEqual(week.meetings, None)
self.assertEqual(len(week.meetings), 2)
- self.assertEqual(week.meetings[1].meeting_name,
- 'Another test meeting2')
- self.assertEqual(week.meetings[1].meeting_information,
- 'This is a test meeting with recursion2')
self.assertEqual(week.meetings[0].meeting_name,
'Fedora-fr-test-meeting')
self.assertEqual(week.meetings[0].meeting_information,
'This is a test meeting')
+ self.assertEqual(week.meetings[1].meeting_name,
+ 'Another test meeting2')
+ self.assertEqual(week.meetings[1].meeting_information,
+ 'This is a test meeting with recursion2')
def test_get_week_empty(self):
""" Test the get_week function with no meetings. """
@@ -319,8 +319,8 @@ class Fedocallibtests(Modeltests):
""" Test the get_future_single_meeting_of_user function on a
empty meeting table. """
self.__setup_calendar()
- meetings = fedocallib.get_future_single_meeting_of_user(self.session,
- 'pingou')
+ meetings = fedocallib.get_future_single_meeting_of_user(
+ self.session, 'pingou')
self.assertNotEqual(meetings, None)
self.assertEqual(len(meetings), 0)
self.assertEqual(meetings, [])
@@ -328,17 +328,21 @@ class Fedocallibtests(Modeltests):
def test_get_future_regular_meeting_of_user(self):
""" Test the get_future_regular_meeting_of_user function. """
self.__setup_meeting()
- meetings = fedocallib.get_future_regular_meeting_of_user(self.session,
- 'pingou')
+ meetings = fedocallib.get_future_regular_meeting_of_user(
+ self.session, 'pingou')
self.assertNotEqual(meetings, None)
- self.assertEqual(len(meetings), 2)
+ self.assertEqual(len(meetings), 3)
self.assertEqual(meetings[0].meeting_name,
- 'Another test meeting')
+ 'Another test meeting2')
self.assertEqual(meetings[0].meeting_information,
- 'This is a test meeting with recursion')
+ 'This is a test meeting with recursion2')
self.assertEqual(meetings[1].meeting_name,
- 'Test meeting with reminder and recursion')
+ 'Another test meeting')
self.assertEqual(meetings[1].meeting_information,
+ 'This is a test meeting with recursion')
+ self.assertEqual(meetings[2].meeting_name,
+ 'Test meeting with reminder and recursion')
+ self.assertEqual(meetings[2].meeting_information,
'This is a test meeting with recursion and reminder')
def test_get_future_regular_meeting_of_user_empty(self):
diff --git a/fedocal/tests/test_week.py b/fedocal/tests/test_week.py
index f3ce9f2..ab5f81e 100644
--- a/fedocal/tests/test_week.py
+++ b/fedocal/tests/test_week.py
@@ -75,7 +75,7 @@ class Weektests(Modeltests):
self.assertNotEqual(weekobj, None)
self.assertEqual(weekobj.start_date, TODAY)
self.assertEqual(weekobj.stop_date, end_date)
- self.assertEqual(len(weekobj.meetings), 4)
+ self.assertEqual(len(weekobj.meetings), 2)
def test_repr_week(self):
""" Test if the week string representation is correct. """
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 80c125d39edc9df8134b63732fa061753e1621b9
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sun Nov 4 15:36:28 2012 +0100
Only show the recursive text if the meeting is recursive and remove debug prints
>---------------------------------------------------------------
fedocal/templates/edit_meeting.html | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/fedocal/templates/edit_meeting.html b/fedocal/templates/edit_meeting.html
index 0fc37e7..0089c22 100644
--- a/fedocal/templates/edit_meeting.html
+++ b/fedocal/templates/edit_meeting.html
@@ -23,10 +23,8 @@
<p>If this is a regular meeting this is where you want to set it as so.</p>
<table>
{{ render_field_in_row(form.frequency) }}
-{{meeting.recursion.recursion_frequency}}
{{ render_field_in_row(form.end_repeats,
after='Leave empty if there is no end date for the repeat.') }}
-{{meeting.recursion.recursion_ends}}
</table>
<h4>Reminder</h4>
@@ -38,11 +36,12 @@
{{ render_field_in_row(form.remind_who) }}
</table>
+{% if meeting.recursion_frequency %}
<h4>Edit all?</h4>
-<p>This meeting is a recursive meeting, by default your changes will only
-affect this meeting unless you explecitely say otherwise:
+<p>This meeting is a recursive meeting, your changes will
+affect all the meetings related.
</p>
-{{ render_field(form.recursive_edit) }}
+{% endif %}
<p class="buttons indent">
<input type="submit" class="submit positive" value="Edit">