added ptask
[www.git] / www / ptask / files / patches / task_2.2.0_timesheet.patch
1 diff --git a/src/commands/CmdTimesheet.cpp b/src/commands/CmdTimesheet.cpp
2 index 32a7e12..0bd9336 100644
3 --- a/src/commands/CmdTimesheet.cpp
4 +++ b/src/commands/CmdTimesheet.cpp
5 @@ -59,6 +59,8 @@ int CmdTimesheet::execute (std::string& output)
6    std::vector <Task> all = context.tdb2.all_tasks ();
7    context.tdb2.commit ();
8  
9 +  std::string prj = context.config.get("project");
10 +
11    // What day of the week does the user consider the first?
12    int weekStart = Date::dayOfWeek (context.config.get ("weekstart"));
13    if (weekStart != 0 && weekStart != 1)
14 @@ -108,6 +110,9 @@ int CmdTimesheet::execute (std::string& output)
15        // If task completed within range.
16        if (task->getStatus () == Task::completed)
17        {
18 +        if (!prj.empty() && task->get("project") != prj)
19 +          continue ;
20 +
21          Date compDate (task->get_date ("end"));
22          if (compDate >= start && compDate < end)
23          {
24 @@ -163,7 +168,8 @@ int CmdTimesheet::execute (std::string& output)
25      {
26        // If task started within range, but not completed withing range.
27        if (task->getStatus () == Task::pending &&
28 -          task->has ("start"))
29 +          task->has ("start") &&
30 +          (prj.empty() || task->get("project") == prj))
31        {
32          Date startDate (task->get_date ("start"));
33          if (startDate >= start && startDate < end)