- Fixed bug whereby if no columns labels were specified, it was
  considered a column count mismatch.
- Fixed unit tests to use m/d/Y not M/D/Y dateformat.
This commit is contained in:
Paul Beckingham 2009-03-29 21:27:48 -04:00
parent 2700713c03
commit 8ab3c1cc3c
2 changed files with 8 additions and 6 deletions

View file

@ -2044,13 +2044,14 @@ std::string handleCustomReport (
std::vector <std::string> labels; std::vector <std::string> labels;
split (labels, labelList, ','); split (labels, labelList, ',');
if (columns.size () != labels.size ()) if (columns.size () != labels.size () && labels.size () != 0)
throw std::string ("There are a different number of columns than labels ") + throw std::string ("There are a different number of columns than labels ") +
"for report '" + report + "'. Please correct this."; "for report '" + report + "'. Please correct this.";
std::map <std::string, std::string> columnLabels; std::map <std::string, std::string> columnLabels;
for (unsigned int i = 0; i < columns.size (); ++i) if (labels.size ())
columnLabels[columns[i]] = labels[i]; for (unsigned int i = 0; i < columns.size (); ++i)
columnLabels[columns[i]] = labels[i];
std::string sortList = conf.get ("report." + report + ".sort"); std::string sortList = conf.get ("report." + report + ".sort");
std::vector <std::string> sortOrder; std::vector <std::string> sortOrder;

View file

@ -37,17 +37,18 @@ if (open my $fh, '>', 'due.rc')
"due=4\n", "due=4\n",
"color=on\n", "color=on\n",
"color.due=red\n", "color.due=red\n",
"_forcecolor=on\n"; "_forcecolor=on\n",
"dateformat=m/d/Y\n";
close $fh; close $fh;
ok (-r 'due.rc', 'Created due.rc'); ok (-r 'due.rc', 'Created due.rc');
} }
# Add a task that is almost due, and one that is just due. # Add a task that is almost due, and one that is just due.
my ($d, $m, $y) = (localtime (time + 3 * 86_400))[3..5]; my ($d, $m, $y) = (localtime (time + 3 * 86_400))[3..5];
my $just = sprintf ("%d/%02d/%d", $m + 1, $d, $y + 1900); my $just = sprintf ("%d/%d/%d", $m + 1, $d, $y + 1900);
($d, $m, $y) = (localtime (time + 5 * 86_400))[3..5]; ($d, $m, $y) = (localtime (time + 5 * 86_400))[3..5];
my $almost = sprintf ("%d/%02d/%d", $m + 1, $d, $y + 1900); my $almost = sprintf ("%d/%d/%d", $m + 1, $d, $y + 1900);
qx{../task rc:due.rc add one due:$just}; qx{../task rc:due.rc add one due:$just};
qx{../task rc:due.rc add two due:$almost}; qx{../task rc:due.rc add two due:$almost};