Skip to content

Commit ff09b53

Browse files
committed
Add estimated completion and deadline difference
1 parent 1fdc562 commit ff09b53

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

clientgui/ViewWork.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#define COLUMN_APPLICATION 6
5454
#define COLUMN_NAME 7
5555
#define COLUMN_ESTIMATEDCOMPLETION 8
56-
//#define COLUMN_DEADLINEDIFF 9
56+
#define COLUMN_DEADLINEDIFF 9
5757

5858

5959
// DefaultShownColumns is an array containing the
@@ -187,21 +187,19 @@ static bool CompareViewWorkItems(int iRowIndex1, int iRowIndex2) {
187187
result = work1->m_strStatus.CmpNoCase(work2->m_strStatus);
188188
break;
189189
case COLUMN_ESTIMATEDCOMPLETION:
190-
wxDateTime now = wxDateTime::Now();
191-
wxTimeSpan time_to_completion_work1 = convert_to_timespan(work1->m_fTimeToCompletion);
192-
wxTimeSpan time_to_completion_work2 = convert_to_timespan(work2->m_fTimeToCompletion);
193-
wxDateTime estimated_completion_work1 = now.Add(time_to_completion_work1);
194-
wxDateTime estimated_completion_work2 = now.Add(time_to_completion_work2);
195-
if (estimated_completion_work1.IsEarlierThan(estimated_completion_work2)) {
190+
if (work1->m_tEstimatedCompletion < work2->m_tEstimatedCompletion) {
191+
result = -1;
192+
} else if (work1->m_tEstimatedCompletion > work2->m_tEstimatedCompletion) {
193+
result = 1;
194+
}
195+
break;
196+
case COLUMN_DEADLINEDIFF:
197+
if (work1->m_tDeadlineDiff < work2->m_tDeadlineDiff) {
196198
result = -1;
197-
} else if (estimated_completion_work1.IsLaterThan(estimated_completion_work2) ||
198-
estimated_completion_work1.IsEqualTo(estimated_completion_work2)) {
199+
} else if (work1->m_tDeadlineDiff > work2->m_tDeadlineDiff) {
199200
result = 1;
200201
}
201202
break;
202-
//case COLUMN_DEADLINEDIFF:
203-
// SOMETHING GOES IN HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
204-
// break;
205203
}
206204

207205
// Always return FALSE for equality (result == 0)
@@ -287,7 +285,7 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
287285
m_aStdColNameOrder->Insert(_("Application"), COLUMN_APPLICATION);
288286
m_aStdColNameOrder->Insert(_("Name"), COLUMN_NAME);
289287
m_aStdColNameOrder->Insert(_("Estimated Completion"), COLUMN_ESTIMATEDCOMPLETION);
290-
//m_aStdColNameOrder->Insert(_("Completion Before Deadline"), COLUMN_DEADLINEDIFF);
288+
m_aStdColNameOrder->Insert(_("Completion Before Deadline"), COLUMN_DEADLINEDIFF);
291289

292290
// m_iStdColWidthOrder is an array of the width for each column.
293291
// Entries must be in order of ascending Column ID. We initialize
@@ -305,7 +303,7 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
305303
m_iStdColWidthOrder.Insert(95, COLUMN_APPLICATION);
306304
m_iStdColWidthOrder.Insert(285, COLUMN_NAME);
307305
m_iStdColWidthOrder.Insert(150, COLUMN_ESTIMATEDCOMPLETION);
308-
//m_iStdColWidthOrder.Insert(150, COLUMN_DEADLINEDIFF);
306+
m_iStdColWidthOrder.Insert(150, COLUMN_DEADLINEDIFF);
309307

310308
wxASSERT(m_iStdColWidthOrder.size() == m_aStdColNameOrder->size());
311309

@@ -360,10 +358,10 @@ void CViewWork::AppendColumn(int columnID){
360358
m_pListPane->AppendColumn((*m_aStdColNameOrder)[COLUMN_ESTIMATEDCOMPLETION],
361359
wxLIST_FORMAT_LEFT, m_iStdColWidthOrder[COLUMN_ESTIMATEDCOMPLETION]);
362360
break;
363-
/* case COLUMN_DEADLINEDIFF:
361+
case COLUMN_DEADLINEDIFF:
364362
m_pListPane->AppendColumn((*m_aStdColNameOrder)[COLUMN_DEADLINEDIFF],
365363
wxLIST_FORMAT_LEFT, m_iStdColWidthOrder[COLUMN_DEADLINEDIFF]);
366-
break; */
364+
break;
367365
}
368366
}
369367

@@ -788,9 +786,9 @@ wxString CViewWork::OnListGetItemText(long item, long column) const {
788786
case COLUMN_ESTIMATEDCOMPLETION:
789787
strBuffer = work->m_strEstimatedCompletion;
790788
break;
791-
// case COLUMN_DEADLINEDIFF:
792-
// Fill out something here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
793-
// break;
789+
case COLUMN_DEADLINEDIFF:
790+
strBuffer = work->m_strDeadlineDiff;
791+
break;
794792
}
795793
}
796794

@@ -1129,6 +1127,13 @@ bool CViewWork::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) {
11291127
return true;
11301128
}
11311129
break;
1130+
case COLUMN_DEADLINEDIFF:
1131+
//something!!!!!!!!!!!!!!!!!!!!!!!!!!!
1132+
// - find estimated completion date
1133+
// - get deadline (should not change...right?
1134+
// make the delta between those.
1135+
// If not equal, store
1136+
break;
11321137
case COLUMN_STATUS:
11331138
int i = m_iSortedIndexes[iRowIndex];
11341139
RESULT* result = wxGetApp().GetDocument()->result(i);

clientgui/ViewWork.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ class CWork : public wxObject
4040
double m_fTimeToCompletion;
4141
time_t m_tReportDeadline;
4242
time_t m_tEstimatedCompletion;
43+
time_t m_tDeadlineDiff;
4344
wxString m_strStatus;
4445
wxString m_strProjectURL; // Used internally, not displayed
4546
wxString m_strCPUTime;
4647
wxString m_strProgress;
4748
wxString m_strTimeToCompletion;
4849
wxString m_strReportDeadline;
4950
wxString m_strEstimatedCompletion;
51+
wxString m_strDeadlineDiff;
5052
};
5153

5254

0 commit comments

Comments
 (0)