Bug 137309 - incomplete time reports totals
Summary: incomplete time reports totals
Status: RESOLVED FIXED
Alias: None
Product: ktimetracker
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Thorsten Staerk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-14 02:12 UTC by Ross Boylan
Modified: 2006-11-19 16:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
This patch solves the problem. (1.33 KB, patch)
2006-11-14 22:10 UTC, Thorsten Staerk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Boylan 2006-11-14 02:12:03 UTC
Version:           1.6.0 (using KDE 3.5.5, Debian Package 4:3.5.5a.dfsg.1-3 (4.0))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.17-2-k7

When I use copy totals to clipboard or copy history to clipboard, I only get some of the tasks, even if I ask it to show me all of them.  I seem to get the task which is active always, and sometimes another one.

When I export to csv, I get all the tasks.

There is a similar Debian bug report, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=374993, but it claims the problem only occurs when a subtask is selected.  I have only top-level tasks, and still see it.

It's probably not related, but the csv history shows another oddity: a day with over 48 hours in it!  I'm not sure if this could have arisen from some mistake on my part, but it doesn't seem right.  I do have some time reported in both the day before and the day after this one.

It may also be relevant that I've been using karm on two machines and copying the files in .kde/share/apps/karm back and forth.  I may have done this when the app was open once or twice.
Comment 1 Thorsten Staerk 2006-11-14 17:19:14 UTC
I can reproduce this. It seems to me that "Copy all Tasks" starts copying the tasks from the position of activeTask on.
Comment 2 Thorsten Staerk 2006-11-14 22:10:23 UTC
Created attachment 18559 [details]
This patch solves the problem.
Comment 3 Thorsten Staerk 2006-11-14 22:18:02 UTC
SVN commit 604968 by tstaerk:

Copy all tasks to clipboard.
BUGS:137309


 M  +3 -3      taskview.cpp  
 M  +4 -1      timekard.cpp  


--- branches/KDE/3.5/kdepim/karm/taskview.cpp #604967:604968
@@ -797,13 +797,13 @@
         i18n("Copy totals for just this task and its subtasks, or copy totals for all tasks?"),
         i18n("Copy Totals to Clipboard"),
         i18n("Copy This Task"), i18n("Copy All Tasks") );
-    if (response == KMessageBox::Yes) // this task only
+    if (response == KMessageBox::Yes) // This task only
     {
       KApplication::clipboard()->setText(t.totalsAsText(this, true, TimeKard::TotalTime));
     }
-    else // only task
+    else // All tasks
     {
-      KApplication::clipboard()->setText(t.totalsAsText(this, true, TimeKard::TotalTime));
+      KApplication::clipboard()->setText(t.totalsAsText(this, false, TimeKard::TotalTime));
     }
   }
   else
--- branches/KDE/3.5/kdepim/karm/timekard.cpp #604967:604968
@@ -46,7 +46,9 @@
 const QString cr = QString::fromLatin1("\n");
 
 QString TimeKard::totalsAsText(TaskView* taskview, bool justThisTask, WhichTime which)
+// Print the total Times as text. If justThisTask, use activeTask, else, all tasks
 {
+  kdDebug(5970) << "Entering TimeKard::totalsAsText" << endl;
   QString retval;
   QString line;
   QString buf;
@@ -77,9 +79,10 @@
     else
     {
       sum = 0;
-      for (Task* task= taskview->current_item(); task;
+      for (Task* task= taskview->item_at_index(0); task;
           task= task->nextSibling())
       {
+        kdDebug(5970) << "Copying task " << task->name() << endl;
         int time = which == TotalTime ? task->totalTime() : task->totalSessionTime();
         sum += time;
         if ( time || task->firstChild() )
Comment 4 Ross Boylan 2006-11-14 22:18:12 UTC
Thank you!
Ross
On Tue, 2006-11-14 at 21:10 +0000, tstaerk wrote:
[bugs.kde.org quoted mail]
Comment 5 Ross Boylan 2006-11-14 22:20:09 UTC
Did you mean for the debugging statement to be in the final version?
+        kdDebug(5970) << "Copying task " << task->name() << endl; 
Comment 6 Thorsten Staerk 2006-11-15 10:16:03 UTC
The line

+        kdDebug(5970) << "Copying task " << task->name() << endl; 

indeed is to be in the final version. Who wants to develop the program, needs debugging output. Who does not want, compiles with --disable-debug.

Thanks for the remark anyway.
Comment 7 Thorsten Staerk 2006-11-19 16:28:07 UTC
SVN commit 606176 by tstaerk:

Copy all total times to clipboard, not only some.
CCBUGS:137309


 M  +6 -2      timekard.cpp  


--- trunk/KDE/kdepim/karm/timekard.cpp #606175:606176
@@ -49,6 +49,7 @@
 
 QString TimeKard::totalsAsText(TaskView* taskview, ReportCriteria rc)
 {
+  kDebug(5970) << "Entering TimeKard::totalsAsText" << endl;
   QString retval;
   QString line;
   QString buf;
@@ -80,7 +81,7 @@
     else // print all tasks
     {
       sum = 0;
-      for (Task* task= taskview->current_item(); task;
+      for (Task* task= taskview->item_at_index(0); task;
           task= task->nextSibling())
       {
         if (!rc.sessionTimes) sum += task->totalTime();
@@ -106,6 +107,7 @@
 // Print out "<indent for level> <task total> <task>", for task and subtasks. Used by totalsAsText.
 void TimeKard::printTask(Task *task, QString &s, int level, const ReportCriteria &rc)
 {
+  kDebug(5970) << "Entering TimeKard::printTask" << endl;
   QString buf;
 
   s += buf.fill(' ', level);
@@ -147,6 +149,7 @@
     const QDate& to,
     const int level, QString& s, bool totalsOnly)
 {
+  kDebug(5970) << "Entering TimeKard::printTaskHistory" << endl;
   long sectionsum = 0;
   for ( QDate day = from; day <= to; day = day.addDays(1) )
   {
@@ -202,7 +205,7 @@
   const QString& name,
   bool justThisTask, bool totalsOnly)
 {
-
+  kDebug(5970) << "Entering TimeKard::sectionHistoryAsText" << endl;
   const int sectionReportWidth = taskWidth + ( totalsOnly ? 0 : sectionFrom.daysTo(sectionTo) * timeWidth ) + totalTimeWidth;
   assert( sectionReportWidth > 0 );
   QString line;
@@ -324,6 +327,7 @@
 QString TimeKard::historyAsText(TaskView* taskview, const QDate& from,
     const QDate& to, bool justThisTask, bool perWeek, bool totalsOnly)
 {
+  kDebug(5970) << "Entering TimeKard::historyAsText" << endl;
   // header
   QString retval;
   retval += totalsOnly ? i18n("Task Totals") : i18n("Task History");