Bug Fix - calendar
- Fixed bug that showed a calendar for the year 2037 when 'task calendar due' was run, and there are no tasks with due dates.
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
+ Added feature #292 that permits alternate line coloration in reports
|
||||
(thanks to Richard Querin).
|
||||
+ The 'delete' command is now aliased to 'rm' (thanks to Ivo Jimenez).
|
||||
+ Fixed bug that showed a calendar for the year 2037 when 'task calendar due'
|
||||
was run, and there are no tasks with due dates.
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
||||
@@ -1536,6 +1536,7 @@ int handleReportCalendar (std::string &outs)
|
||||
yFrom = atoi( context.args[2].data());
|
||||
}
|
||||
|
||||
int countDueDates = 0;
|
||||
if (getpendingdate == true) {
|
||||
// Find the oldest pending due date.
|
||||
Date oldest (12,31,2037);
|
||||
@@ -1545,6 +1546,7 @@ int handleReportCalendar (std::string &outs)
|
||||
{
|
||||
if (task->has ("due"))
|
||||
{
|
||||
++countDueDates;
|
||||
Date d (atoi (task->get ("due").c_str ()));
|
||||
if (d < oldest) oldest = d;
|
||||
}
|
||||
@@ -1554,6 +1556,11 @@ int handleReportCalendar (std::string &outs)
|
||||
yFrom = oldest.year();
|
||||
}
|
||||
|
||||
// If there are no tasks with due dates, then prevent showing a calendar from
|
||||
// the year 2037.
|
||||
if (countDueDates == 0)
|
||||
throw std::string ("There are no tasks that have due dates.");
|
||||
|
||||
mTo = mFrom + monthsToDisplay - 1;
|
||||
yTo = yFrom;
|
||||
if (mTo > 12) {
|
||||
|
||||
Reference in New Issue
Block a user