mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Code Cleanup
- Eliminated redundant getDueDate helper function.
This commit is contained in:
parent
0f4bcefcff
commit
facb795f88
5 changed files with 17 additions and 18 deletions
|
@ -219,7 +219,8 @@ int CmdInfo::execute (std::string& output)
|
||||||
if (format == "")
|
if (format == "")
|
||||||
format = context.config.get ("dateformat");
|
format = context.config.get ("dateformat");
|
||||||
|
|
||||||
view.set (row, 1, getDueDate (*task, format));
|
Date dt (task->get_date ("due"));
|
||||||
|
view.set (row, 1, dt.toString (context.config.get ("dateformat")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait
|
// wait
|
||||||
|
|
|
@ -374,7 +374,7 @@ int CmdShow::execute (std::string& output)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check for bad values in rc.annotations.
|
// Check for bad values in rc.annotations.
|
||||||
// TODO Reconsider this.
|
// TODO Deprecated.
|
||||||
std::string annotations = context.config.get ("annotations");
|
std::string annotations = context.config.get ("annotations");
|
||||||
if (annotations != "full" &&
|
if (annotations != "full" &&
|
||||||
annotations != "sparse" &&
|
annotations != "sparse" &&
|
||||||
|
|
|
@ -120,7 +120,13 @@ int CmdTimesheet::execute (std::string& output)
|
||||||
if (format == "")
|
if (format == "")
|
||||||
format = context.config.get ("dateformat");
|
format = context.config.get ("dateformat");
|
||||||
completed.set (row, 1, task->get ("project"), c);
|
completed.set (row, 1, task->get ("project"), c);
|
||||||
completed.set (row, 2, getDueDate (*task, format), c);
|
|
||||||
|
if(task->has ("due"))
|
||||||
|
{
|
||||||
|
Date dt (task->get_date ("due"));
|
||||||
|
completed.set (row, 2, dt.toString (format));
|
||||||
|
}
|
||||||
|
|
||||||
completed.set (row, 3, getFullDescription (*task, "timesheet"), c);
|
completed.set (row, 3, getFullDescription (*task, "timesheet"), c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +164,13 @@ int CmdTimesheet::execute (std::string& output)
|
||||||
if (format == "")
|
if (format == "")
|
||||||
format = context.config.get ("dateformat");
|
format = context.config.get ("dateformat");
|
||||||
started.set (row, 1, task->get ("project"), c);
|
started.set (row, 1, task->get ("project"), c);
|
||||||
started.set (row, 2, getDueDate (*task, format), c);
|
|
||||||
|
if(task->has ("due"))
|
||||||
|
{
|
||||||
|
Date dt (task->get_date ("due"));
|
||||||
|
started.set (row, 2, dt.toString (format));
|
||||||
|
}
|
||||||
|
|
||||||
started.set (row, 3, getFullDescription (*task, "timesheet"), c);
|
started.set (row, 3, getFullDescription (*task, "timesheet"), c);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,17 +106,4 @@ std::string getFullDescription (Task& task, const std::string& report)
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
std::string getDueDate (Task& task, const std::string& format)
|
|
||||||
{
|
|
||||||
std::string due = task.get ("due");
|
|
||||||
if (due.length ())
|
|
||||||
{
|
|
||||||
Date d (atoi (due.c_str ()));
|
|
||||||
due = d.toString (format);
|
|
||||||
}
|
|
||||||
|
|
||||||
return due;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -50,7 +50,6 @@ bool nag (Task&);
|
||||||
|
|
||||||
// helpers.cpp
|
// helpers.cpp
|
||||||
std::string getFullDescription (Task&, const std::string&);
|
std::string getFullDescription (Task&, const std::string&);
|
||||||
std::string getDueDate (Task&, const std::string&);
|
|
||||||
|
|
||||||
// rules.cpp
|
// rules.cpp
|
||||||
void initializeColorRules ();
|
void initializeColorRules ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue