MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / execute

Method execute

src/commands/CmdHistory.cpp:286–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284////////////////////////////////////////////////////////////////////////////////
285template <class HistoryStrategy>
286int CmdHistoryBase<HistoryStrategy>::execute(std::string& output) {
287 rc = 0;
288
289 // TODO is this necessary?
290 groups.clear();
291 addedGroup.clear();
292 deletedGroup.clear();
293 completedGroup.clear();
294
295 // Apply filter.
296 Filter filter;
297 std::vector<Task> filtered;
298 filter.subset(filtered);
299
300 for (auto& task : filtered) {
301 Datetime entry(task.get_date("entry"));
302
303 Datetime end;
304 if (task.has("end")) end = Datetime(task.get_date("end"));
305
306 auto epoch = HistoryStrategy::getRelevantDate(entry).toEpoch();
307 groups[epoch] = 0;
308
309 // Every task has an entry date, but exclude templates.
310 if (task.getStatus() != Task::recurring) ++addedGroup[epoch];
311
312 // All deleted tasks have an end date.
313 if (task.getStatus() == Task::deleted) {
314 epoch = HistoryStrategy::getRelevantDate(end).toEpoch();
315 groups[epoch] = 0;
316 ++deletedGroup[epoch];
317 }
318
319 // All completed tasks have an end date.
320 else if (task.getStatus() == Task::completed) {
321 epoch = HistoryStrategy::getRelevantDate(end).toEpoch();
322 groups[epoch] = 0;
323 ++completedGroup[epoch];
324 }
325 }
326
327 // Now build the view.
328 if (HistoryStrategy::graphical)
329 this->outputGraphical(output);
330 else
331 this->outputTabular(output);
332
333 return rc;
334}
335
336////////////////////////////////////////////////////////////////////////////i
337class MonthlyGHistoryStrategy {

Callers

nothing calls this directly

Calls 7

outputGraphicalMethod · 0.95
outputTabularMethod · 0.95
clearMethod · 0.80
subsetMethod · 0.80
getStatusMethod · 0.80
get_dateMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected