mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 13:23:08 +02:00
- "calendar" command now uses oldest and newest due dates for limits.
This commit is contained in:
parent
0ec24aaef5
commit
3077c50774
1 changed files with 17 additions and 12 deletions
29
src/task.cpp
29
src/task.cpp
|
@ -1876,38 +1876,43 @@ void handleReportCalendar (const TDB& tdb, T& task, Config& conf)
|
|||
|
||||
// Find the oldest pending due date.
|
||||
Date oldest;
|
||||
Date newest;
|
||||
std::vector <T>::iterator it;
|
||||
for (it = pending.begin (); it != pending.end (); ++it)
|
||||
{
|
||||
if (it->getAttribute ("due") != "")
|
||||
{
|
||||
Date d (::atoi (it->getAttribute ("due").c_str ()));
|
||||
if (d < oldest)
|
||||
oldest = d;
|
||||
|
||||
if (d < oldest) oldest = d;
|
||||
if (d > newest) newest = d;
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate from oldest due month, year to now.
|
||||
// Iterate from oldest due month, year to newest month, year.
|
||||
Date today;
|
||||
int m = oldest.month ();
|
||||
int y = oldest.year ();
|
||||
int mFrom = oldest.month ();
|
||||
int yFrom = oldest.year ();
|
||||
|
||||
int mTo = newest.month ();
|
||||
int yTo = newest.year ();
|
||||
|
||||
std::cout << std::endl;
|
||||
std::string output;
|
||||
while (y < today.year () || (y == today.year () && m <= today.month ()))
|
||||
while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo))
|
||||
{
|
||||
std::cout << Date::monthName (m)
|
||||
std::cout << Date::monthName (mFrom)
|
||||
<< " "
|
||||
<< y
|
||||
<< yFrom
|
||||
<< std::endl
|
||||
<< std::endl
|
||||
<< renderMonth (m, y, today, pending, conf)
|
||||
<< renderMonth (mFrom, yFrom, today, pending, conf)
|
||||
<< std::endl;
|
||||
|
||||
if (++m == 13)
|
||||
if (++mFrom == 13)
|
||||
{
|
||||
m = 1;
|
||||
++y;
|
||||
mFrom = 1;
|
||||
++yFrom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue