CmdHistory: Migrated from ISO8601d to Datetime

This commit is contained in:
Paul Beckingham 2016-12-17 22:13:31 -05:00
parent d3b25f7325
commit 0cf056f4b2

View file

@ -34,7 +34,7 @@
#include <format.h> #include <format.h>
#include <util.h> #include <util.h>
#include <i18n.h> #include <i18n.h>
#include <ISO8601.h> #include <Datetime.h>
extern Context context; extern Context context;
@ -72,11 +72,11 @@ int CmdHistoryMonthly::execute (std::string& output)
for (auto& task : filtered) for (auto& task : filtered)
{ {
ISO8601d entry (task.get_date ("entry")); Datetime entry (task.get_date ("entry"));
ISO8601d end; Datetime end;
if (task.has ("end")) if (task.has ("end"))
end = ISO8601d (task.get_date ("end")); end = Datetime (task.get_date ("end"));
time_t epoch = entry.startOfMonth ().toEpoch (); time_t epoch = entry.startOfMonth ().toEpoch ();
groups[epoch] = 0; groups[epoch] = 0;
@ -134,16 +134,16 @@ int CmdHistoryMonthly::execute (std::string& output)
totalCompleted += completedGroup [i.first]; totalCompleted += completedGroup [i.first];
totalDeleted += deletedGroup [i.first]; totalDeleted += deletedGroup [i.first];
ISO8601d dt (i.first); Datetime dt (i.first);
int m, d, y; int m, d, y;
dt.toMDY (m, d, y); dt.toYMD (y, m, d);
if (y != priorYear) if (y != priorYear)
{ {
view.set (row, 0, y); view.set (row, 0, y);
priorYear = y; priorYear = y;
} }
view.set (row, 1, ISO8601d::monthName(m)); view.set (row, 1, Datetime::monthName(m));
int net = 0; int net = 0;
@ -239,11 +239,11 @@ int CmdHistoryAnnual::execute (std::string& output)
for (auto& task : filtered) for (auto& task : filtered)
{ {
ISO8601d entry (task.get_date ("entry")); Datetime entry (task.get_date ("entry"));
ISO8601d end; Datetime end;
if (task.has ("end")) if (task.has ("end"))
end = ISO8601d (task.get_date ("end")); end = Datetime (task.get_date ("end"));
time_t epoch = entry.startOfYear ().toEpoch (); time_t epoch = entry.startOfYear ().toEpoch ();
groups[epoch] = 0; groups[epoch] = 0;
@ -300,9 +300,9 @@ int CmdHistoryAnnual::execute (std::string& output)
totalCompleted += completedGroup [i.first]; totalCompleted += completedGroup [i.first];
totalDeleted += deletedGroup [i.first]; totalDeleted += deletedGroup [i.first];
ISO8601d dt (i.first); Datetime dt (i.first);
int m, d, y; int m, d, y;
dt.toMDY (m, d, y); dt.toYMD (y, m, d);
if (y != priorYear) if (y != priorYear)
{ {
@ -403,11 +403,11 @@ int CmdGHistoryMonthly::execute (std::string& output)
for (auto& task : filtered) for (auto& task : filtered)
{ {
ISO8601d entry (task.get_date ("entry")); Datetime entry (task.get_date ("entry"));
ISO8601d end; Datetime end;
if (task.has ("end")) if (task.has ("end"))
end = ISO8601d (task.get_date ("end")); end = Datetime (task.get_date ("end"));
time_t epoch = entry.startOfMonth ().toEpoch (); time_t epoch = entry.startOfMonth ().toEpoch ();
groups[epoch] = 0; groups[epoch] = 0;
@ -482,16 +482,16 @@ int CmdGHistoryMonthly::execute (std::string& output)
totalCompleted += completedGroup[i.first]; totalCompleted += completedGroup[i.first];
totalDeleted += deletedGroup[i.first]; totalDeleted += deletedGroup[i.first];
ISO8601d dt (i.first); Datetime dt (i.first);
int m, d, y; int m, d, y;
dt.toMDY (m, d, y); dt.toYMD (y, m, d);
if (y != priorYear) if (y != priorYear)
{ {
view.set (row, 0, y); view.set (row, 0, y);
priorYear = y; priorYear = y;
} }
view.set (row, 1, ISO8601d::monthName(m)); view.set (row, 1, Datetime::monthName(m));
unsigned int addedBar = (widthOfBar * addedGroup[i.first]) / maxLine; unsigned int addedBar = (widthOfBar * addedGroup[i.first]) / maxLine;
unsigned int completedBar = (widthOfBar * completedGroup[i.first]) / maxLine; unsigned int completedBar = (widthOfBar * completedGroup[i.first]) / maxLine;
@ -605,11 +605,11 @@ int CmdGHistoryAnnual::execute (std::string& output)
for (auto& task : filtered) for (auto& task : filtered)
{ {
ISO8601d entry (task.get_date ("entry")); Datetime entry (task.get_date ("entry"));
ISO8601d end; Datetime end;
if (task.has ("end")) if (task.has ("end"))
end = ISO8601d (task.get_date ("end")); end = Datetime (task.get_date ("end"));
time_t epoch = entry.startOfYear ().toEpoch (); time_t epoch = entry.startOfYear ().toEpoch ();
groups[epoch] = 0; groups[epoch] = 0;
@ -683,9 +683,9 @@ int CmdGHistoryAnnual::execute (std::string& output)
totalCompleted += completedGroup[i.first]; totalCompleted += completedGroup[i.first];
totalDeleted += deletedGroup[i.first]; totalDeleted += deletedGroup[i.first];
ISO8601d dt (i.first); Datetime dt (i.first);
int m, d, y; int m, d, y;
dt.toMDY (m, d, y); dt.toYMD (y, m, d);
if (y != priorYear) if (y != priorYear)
{ {