mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdReportDay: Untracked time is no longer subtracted from one day, but the whole range
This commit is contained in:
parent
fed901fc99
commit
8beaacf00e
1 changed files with 10 additions and 9 deletions
|
@ -261,11 +261,12 @@ static void renderSummary (
|
||||||
const std::vector <Range>& exclusions,
|
const std::vector <Range>& exclusions,
|
||||||
const std::vector <Interval>& tracked)
|
const std::vector <Interval>& tracked)
|
||||||
{
|
{
|
||||||
time_t unavailable = 0;
|
time_t total_unavailable = 0;
|
||||||
for (auto& exclusion : exclusions)
|
for (auto& exclusion : exclusions)
|
||||||
unavailable += exclusion.total ();
|
if (filter.range.overlap (exclusion))
|
||||||
|
total_unavailable += filter.range.intersect (exclusion).total ();
|
||||||
|
|
||||||
time_t worked = 0;
|
time_t total_worked = 0;
|
||||||
for (auto& interval : tracked)
|
for (auto& interval : tracked)
|
||||||
{
|
{
|
||||||
if (filter.range.overlap (interval.range))
|
if (filter.range.overlap (interval.range))
|
||||||
|
@ -274,19 +275,19 @@ static void renderSummary (
|
||||||
if (interval.range.is_open ())
|
if (interval.range.is_open ())
|
||||||
clipped.range.end = Datetime ();
|
clipped.range.end = Datetime ();
|
||||||
|
|
||||||
worked += clipped.range.total ();
|
total_worked += clipped.range.total ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto all_day = 86400 - unavailable;
|
auto total_available = filter.range.total () - total_unavailable;
|
||||||
auto remaining = all_day - worked;
|
auto total_remaining = total_available - total_worked;
|
||||||
|
|
||||||
std::cout << indent << "Tracked "
|
std::cout << indent << "Tracked "
|
||||||
<< std::setw (13) << std::setfill (' ') << Duration (worked).format () << '\n'
|
<< std::setw (13) << std::setfill (' ') << Duration (total_worked).format () << '\n'
|
||||||
<< indent << "Remaining "
|
<< indent << "Remaining "
|
||||||
<< std::setw (13) << std::setfill (' ') << Duration (remaining).format () << '\n'
|
<< std::setw (13) << std::setfill (' ') << Duration (total_remaining).format () << '\n'
|
||||||
<< indent << "Total "
|
<< indent << "Total "
|
||||||
<< std::setw (13) << std::setfill (' ') << Duration (all_day).format () << '\n'
|
<< std::setw (13) << std::setfill (' ') << Duration (total_available).format () << '\n'
|
||||||
<< '\n';
|
<< '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue