From dc3470a9a859de5abab6bc5f12d6daa2a6bec005 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 22 Oct 2011 23:04:36 -0400 Subject: [PATCH] Bug - Fixed problem where burndown chart titles were displayed in postfix, rather than original form. --- src/commands/CmdBurndown.cpp | 56 ++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/src/commands/CmdBurndown.cpp b/src/commands/CmdBurndown.cpp index 22e9bdab4..610d92841 100644 --- a/src/commands/CmdBurndown.cpp +++ b/src/commands/CmdBurndown.cpp @@ -147,7 +147,6 @@ public: Chart& operator= (const Chart&); // Unimplemented ~Chart (); - void description (const std::string&); void scan (std::vector &); std::string render (); @@ -207,6 +206,31 @@ Chart::Chart (char type) // Rates are calculated last. find_rate = 0.0; fix_rate = 0.0; + + // Set the title. + title = "("; + bool before_command = true; + std::vector ::const_iterator arg; + for (arg = context.a3.begin (); arg != context.a3.end (); ++arg) + { + if (arg->_category == Arg::cat_command) + before_command = false; + + if (arg->_category == Arg::cat_program || + arg->_category == Arg::cat_rc || + arg->_category == Arg::cat_override || + arg->_category == Arg::cat_command || + arg->_category == Arg::cat_terminator) + ; + else + { + if (title.length () > 1) + title += " "; + + title += arg->_raw; + } + } + title += ")"; } //////////////////////////////////////////////////////////////////////////////// @@ -214,12 +238,6 @@ Chart::~Chart () { } -//////////////////////////////////////////////////////////////////////////////// -void Chart::description (const std::string& value) -{ - title = value; -} - //////////////////////////////////////////////////////////////////////////////// void Chart::scan (std::vector & tasks) { @@ -956,14 +974,6 @@ int CmdBurndownMonthly::execute (std::string& output) // Create a chart, scan the tasks, then render. Chart chart ('M'); - - // Use any filter as a title. - if (context.a3.size () > 2) - { - std::string combined = "(" + context.a3.extract_filter ().combine () + ")"; - chart.description (combined); - } - chart.scan (filtered); output = chart.render (); return rc; @@ -992,14 +1002,6 @@ int CmdBurndownWeekly::execute (std::string& output) // Create a chart, scan the tasks, then render. Chart chart ('W'); - - // Use any filter as a title. - if (context.a3.size () > 2) - { - std::string combined = "(" + context.a3.extract_filter ().combine () + ")"; - chart.description (combined); - } - chart.scan (filtered); output = chart.render (); return rc; @@ -1028,14 +1030,6 @@ int CmdBurndownDaily::execute (std::string& output) // Create a chart, scan the tasks, then render. Chart chart ('D'); - - // Use any filter as a title. - if (context.a3.size () > 2) - { - std::string combined = "(" + context.a3.extract_filter ().combine () + ")"; - chart.description (combined); - } - chart.scan (filtered); output = chart.render (); return rc;