added ptask
[www.git] / www / ptask / files / patches / task_2.2.0_timesheet.patch
diff --git a/www/ptask/files/patches/task_2.2.0_timesheet.patch b/www/ptask/files/patches/task_2.2.0_timesheet.patch
new file mode 100644 (file)
index 0000000..afc2e56
--- /dev/null
@@ -0,0 +1,33 @@
+diff --git a/src/commands/CmdTimesheet.cpp b/src/commands/CmdTimesheet.cpp
+index 32a7e12..0bd9336 100644
+--- a/src/commands/CmdTimesheet.cpp
++++ b/src/commands/CmdTimesheet.cpp
+@@ -59,6 +59,8 @@ int CmdTimesheet::execute (std::string& output)
+   std::vector <Task> all = context.tdb2.all_tasks ();
+   context.tdb2.commit ();
++  std::string prj = context.config.get("project");
++
+   // What day of the week does the user consider the first?
+   int weekStart = Date::dayOfWeek (context.config.get ("weekstart"));
+   if (weekStart != 0 && weekStart != 1)
+@@ -108,6 +110,9 @@ int CmdTimesheet::execute (std::string& output)
+       // If task completed within range.
+       if (task->getStatus () == Task::completed)
+       {
++        if (!prj.empty() && task->get("project") != prj)
++          continue ;
++
+         Date compDate (task->get_date ("end"));
+         if (compDate >= start && compDate < end)
+         {
+@@ -163,7 +168,8 @@ int CmdTimesheet::execute (std::string& output)
+     {
+       // If task started within range, but not completed withing range.
+       if (task->getStatus () == Task::pending &&
+-          task->has ("start"))
++          task->has ("start") &&
++          (prj.empty() || task->get("project") == prj))
+       {
+         Date startDate (task->get_date ("start"));
+         if (startDate >= start && startDate < end)