mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
- Thanks to php-coder
This commit is contained in:
parent
61c04382ff
commit
8699b60690
4 changed files with 32 additions and 66 deletions
1
AUTHORS
1
AUTHORS
|
@ -322,3 +322,4 @@ suggestions:
|
||||||
Kai HTML
|
Kai HTML
|
||||||
Marc Richter
|
Marc Richter
|
||||||
rjc
|
rjc
|
||||||
|
php-coder
|
||||||
|
|
|
@ -76,7 +76,9 @@
|
||||||
- TW-1938 Adjust behaviour of new-uuid and new-id verbosity levels
|
- TW-1938 Adjust behaviour of new-uuid and new-id verbosity levels
|
||||||
(thanks to Paul J. Fenwick)
|
(thanks to Paul J. Fenwick)
|
||||||
- TW-1947 "urgency.over" filter seems to not work correct
|
- TW-1947 "urgency.over" filter seems to not work correct
|
||||||
(thanks to Marc Richter).
|
(thanks to Marc Richter)
|
||||||
|
- #1964 task burndown shows extra brackets #1964
|
||||||
|
(thanks to php-coder)
|
||||||
- Added 'juhannus' as a synonym for 'midsommarafton'
|
- Added 'juhannus' as a synonym for 'midsommarafton'
|
||||||
(thanks to Lynoure Braakman).
|
(thanks to Lynoure Braakman).
|
||||||
- Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY'
|
- Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY'
|
||||||
|
|
|
@ -144,27 +144,25 @@ private:
|
||||||
unsigned burndown_size (unsigned);
|
unsigned burndown_size (unsigned);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int _width; // Terminal width
|
int _width {}; // Terminal width
|
||||||
int _height; // Terminal height
|
int _height {}; // Terminal height
|
||||||
int _graph_width; // Width of plot area
|
int _graph_width {}; // Width of plot area
|
||||||
int _graph_height; // Height of plot area
|
int _graph_height {}; // Height of plot area
|
||||||
int _max_value; // Largest combined bar value
|
int _max_value {0}; // Largest combined bar value
|
||||||
int _max_label; // Longest y-axis label
|
int _max_label {1}; // Longest y-axis label
|
||||||
std::vector <int> _labels; // Y-axis labels
|
std::vector <int> _labels {}; // Y-axis labels
|
||||||
int _estimated_bars; // Estimated bar count
|
int _estimated_bars {}; // Estimated bar count
|
||||||
int _actual_bars; // Calculated bar count
|
int _actual_bars {0}; // Calculated bar count
|
||||||
std::map <time_t, Bar> _bars; // Epoch-indexed set of bars
|
std::map <time_t, Bar> _bars {}; // Epoch-indexed set of bars
|
||||||
Datetime _earliest; // Date of earliest estimated bar
|
Datetime _earliest {}; // Date of earliest estimated bar
|
||||||
int _carryover_done; // Number of 'done' tasks prior to chart range
|
int _carryover_done {0}; // Number of 'done' tasks prior to chart range
|
||||||
char _period; // D, W, M
|
char _period {}; // D, W, M
|
||||||
std::string _title; // Additional description
|
std::string _grid {}; // String representing grid of characters
|
||||||
std::string _grid; // String representing grid of characters
|
time_t _peak_epoch {}; // Quantized (D) date of highest pending peak
|
||||||
|
int _peak_count {0}; // Corresponding peak pending count
|
||||||
time_t _peak_epoch; // Quantized (D) date of highest pending peak
|
int _current_count {0}; // Current pending count
|
||||||
int _peak_count; // Corresponding peak pending count
|
float _net_fix_rate {0.0}; // Calculated fix rate
|
||||||
int _current_count; // Current pending count
|
std::string _completion {}; // Estimated completion date
|
||||||
float _net_fix_rate; // Calculated fix rate
|
|
||||||
std::string _completion; // Estimated completion date
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -174,8 +172,6 @@ Chart::Chart (char type)
|
||||||
// maximum space, and the width drives various other parameters.
|
// maximum space, and the width drives various other parameters.
|
||||||
_width = Context::getContext ().getWidth ();
|
_width = Context::getContext ().getWidth ();
|
||||||
_height = Context::getContext ().getHeight () - 1; // Allow for new line with prompt.
|
_height = Context::getContext ().getHeight () - 1; // Allow for new line with prompt.
|
||||||
_max_value = 0;
|
|
||||||
_max_label = 1;
|
|
||||||
_graph_height = _height - 7;
|
_graph_height = _height - 7;
|
||||||
_graph_width = _width - _max_label - 14;
|
_graph_width = _width - _max_label - 14;
|
||||||
|
|
||||||
|
@ -183,17 +179,7 @@ Chart::Chart (char type)
|
||||||
// potentially enormous data set.
|
// potentially enormous data set.
|
||||||
_estimated_bars = (_width - 1 - 14) / 3;
|
_estimated_bars = (_width - 1 - 14) / 3;
|
||||||
|
|
||||||
_actual_bars = 0;
|
|
||||||
_period = type;
|
_period = type;
|
||||||
_carryover_done = 0;
|
|
||||||
|
|
||||||
// Rates are calculated last.
|
|
||||||
_net_fix_rate = 0.0;
|
|
||||||
|
|
||||||
// Set the title.
|
|
||||||
std::vector <std::string> words = Context::getContext ().cli2.getWords ();
|
|
||||||
auto filter = join (" ", words);
|
|
||||||
_title = '(' + filter + ')';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -229,7 +215,6 @@ void Chart::scanForPeak (std::vector <Task>& tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the peak, peak date and current.
|
// Find the peak, peak date and current.
|
||||||
_peak_count = 0;
|
|
||||||
for (auto& count : pending)
|
for (auto& count : pending)
|
||||||
{
|
{
|
||||||
if (count.second > _peak_count)
|
if (count.second > _peak_count)
|
||||||
|
@ -402,33 +387,11 @@ std::string Chart::render ()
|
||||||
_grid += std::string (_width, ' ') + '\n';
|
_grid += std::string (_width, ' ') + '\n';
|
||||||
|
|
||||||
// Title.
|
// Title.
|
||||||
std::string full_title;
|
std::string title = _period == 'D' ? "Daily"
|
||||||
switch (_period)
|
: _period == 'W' ? "Weekly"
|
||||||
{
|
: "Monthly";
|
||||||
case 'D': full_title = "Daily"; break;
|
title += std::string (" Burndown");
|
||||||
case 'W': full_title = "Weekly"; break;
|
_grid.replace (LOC (0, (_width - title.length ()) / 2), title.length (), title);
|
||||||
case 'M': full_title = "Monthly"; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
full_title += std::string (" Burndown");
|
|
||||||
|
|
||||||
if (_title.length ())
|
|
||||||
{
|
|
||||||
if (full_title.length () + 1 + _title.length () < (unsigned) _width)
|
|
||||||
{
|
|
||||||
full_title += ' ' + _title;
|
|
||||||
_grid.replace (LOC (0, (_width - full_title.length ()) / 2), full_title.length (), full_title);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_grid.replace (LOC (0, (_width - full_title.length ()) / 2), full_title.length (), full_title);
|
|
||||||
_grid.replace (LOC (1, (_width - _title.length ()) / 2), _title.length (), _title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_grid.replace (LOC (0, (_width - full_title.length ()) / 2), full_title.length (), full_title);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legend.
|
// Legend.
|
||||||
_grid.replace (LOC (_graph_height / 2 - 1, _width - 10), 10, "DD " + leftJustify ("Done", 7));
|
_grid.replace (LOC (_graph_height / 2 - 1, _width - 10), 10, "DD " + leftJustify ("Done", 7));
|
||||||
|
|
|
@ -59,7 +59,7 @@ class TestBurndownCommand(TestCase):
|
||||||
def test_burndown_daily(self):
|
def test_burndown_daily(self):
|
||||||
"""Ensure burndown.daily generates a chart"""
|
"""Ensure burndown.daily generates a chart"""
|
||||||
code, out, err = self.t("burndown.daily")
|
code, out, err = self.t("burndown.daily")
|
||||||
self.assertIn("Daily Burndown ()", out)
|
self.assertIn("Daily Burndown", out)
|
||||||
self.assertIn(".", out)
|
self.assertIn(".", out)
|
||||||
self.assertIn("+", out)
|
self.assertIn("+", out)
|
||||||
self.assertIn("X", out)
|
self.assertIn("X", out)
|
||||||
|
@ -67,13 +67,13 @@ class TestBurndownCommand(TestCase):
|
||||||
def test_burndown_daily_color(self):
|
def test_burndown_daily_color(self):
|
||||||
"""Ensure burndown.daily with color, generates a chart"""
|
"""Ensure burndown.daily with color, generates a chart"""
|
||||||
code, out, err = self.t("burndown.daily rc._forcecolor:on")
|
code, out, err = self.t("burndown.daily rc._forcecolor:on")
|
||||||
self.assertIn("Daily Burndown ()", out)
|
self.assertIn("Daily Burndown", out)
|
||||||
self.assertNotIn("X", out)
|
self.assertNotIn("X", out)
|
||||||
|
|
||||||
def test_burndown_weekly(self):
|
def test_burndown_weekly(self):
|
||||||
"""Ensure burndown.weekly generates a chart"""
|
"""Ensure burndown.weekly generates a chart"""
|
||||||
code, out, err = self.t("burndown.weekly")
|
code, out, err = self.t("burndown.weekly")
|
||||||
self.assertIn("Weekly Burndown ()", out)
|
self.assertIn("Weekly Burndown", out)
|
||||||
self.assertIn(".", out)
|
self.assertIn(".", out)
|
||||||
self.assertIn("+", out)
|
self.assertIn("+", out)
|
||||||
self.assertIn("X", out)
|
self.assertIn("X", out)
|
||||||
|
@ -81,7 +81,7 @@ class TestBurndownCommand(TestCase):
|
||||||
def test_burndown_monthly(self):
|
def test_burndown_monthly(self):
|
||||||
"""Ensure burndown.monthly generates a chart"""
|
"""Ensure burndown.monthly generates a chart"""
|
||||||
code, out, err = self.t("burndown.monthly")
|
code, out, err = self.t("burndown.monthly")
|
||||||
self.assertIn("Monthly Burndown ()", out)
|
self.assertIn("Monthly Burndown", out)
|
||||||
self.assertIn(".", out)
|
self.assertIn(".", out)
|
||||||
self.assertIn("+", out)
|
self.assertIn("+", out)
|
||||||
self.assertIn("X", out)
|
self.assertIn("X", out)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue