mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Enhancement - nag
- Implemented nag feature.
This commit is contained in:
parent
7e2da42f40
commit
840c61cbbf
1 changed files with 15 additions and 14 deletions
|
@ -398,15 +398,17 @@ int getDueState (const std::string& due)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void nag (/*TDB& tdb,*/ Task& task)
|
void nag (Task& task)
|
||||||
{
|
{
|
||||||
/*
|
std::string nagMessage = context.config.get ("nag", "");
|
||||||
std::string nagMessage = context.config.get ("nag", std::string (""));
|
|
||||||
if (nagMessage != "")
|
if (nagMessage != "")
|
||||||
{
|
{
|
||||||
// Load all pending tasks.
|
// Load all pending tasks.
|
||||||
std::vector <T> pending;
|
std::vector <Task> tasks;
|
||||||
tdb.allPendingT (pending);
|
context.tdb.lock (context.config.get ("locking", true));
|
||||||
|
Filter filter;
|
||||||
|
context.tdb.loadPending (tasks, filter);
|
||||||
|
context.tdb.unlock ();
|
||||||
|
|
||||||
// Counters.
|
// Counters.
|
||||||
int overdue = 0;
|
int overdue = 0;
|
||||||
|
@ -417,23 +419,23 @@ void nag (/*TDB& tdb,*/ Task& task)
|
||||||
char pri = ' ';
|
char pri = ' ';
|
||||||
|
|
||||||
// Scan all pending tasks.
|
// Scan all pending tasks.
|
||||||
foreach (t, pending)
|
foreach (t, tasks)
|
||||||
{
|
{
|
||||||
if (t->getId () == task.getId ())
|
if (t->id == task.id)
|
||||||
{
|
{
|
||||||
if (getDueState (t->getAttribute ("due")) == 2)
|
if (getDueState (t->get ("due")) == 2)
|
||||||
isOverdue = true;
|
isOverdue = true;
|
||||||
|
|
||||||
std::string priority = t->getAttribute ("priority");
|
std::string priority = t->get ("priority");
|
||||||
if (priority.length ())
|
if (priority.length ())
|
||||||
pri = priority[0];
|
pri = priority[0];
|
||||||
}
|
}
|
||||||
else if (t->getStatus () == T::pending)
|
else if (t->getStatus () == Task::pending)
|
||||||
{
|
{
|
||||||
if (getDueState (t->getAttribute ("due")) == 2)
|
if (getDueState (t->get ("due")) == 2)
|
||||||
overdue++;
|
overdue++;
|
||||||
|
|
||||||
std::string priority = t->getAttribute ("priority");
|
std::string priority = t->get ("priority");
|
||||||
if (priority.length ())
|
if (priority.length ())
|
||||||
{
|
{
|
||||||
switch (priority[0])
|
switch (priority[0])
|
||||||
|
@ -454,9 +456,8 @@ void nag (/*TDB& tdb,*/ Task& task)
|
||||||
if (pri == ' ' && !overdue && !high && !medium && !low) return;
|
if (pri == ' ' && !overdue && !high && !medium && !low) return;
|
||||||
|
|
||||||
// All the excuses are made, all that remains is to nag the user.
|
// All the excuses are made, all that remains is to nag the user.
|
||||||
std::cout << nagMessage << std::endl;
|
context.message (nagMessage);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue