mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Make display of columns for week number and day of week configurable
Closes #389 Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
a5194c5b2e
commit
f9ca6c6f5e
4 changed files with 51 additions and 13 deletions
1
AUTHORS
1
AUTHORS
|
@ -105,3 +105,4 @@ Thanks to the following, who submitted detailed bug reports and excellent sugges
|
||||||
squirrellyDave
|
squirrellyDave
|
||||||
Edd Salkield
|
Edd Salkield
|
||||||
Oivvio Polite
|
Oivvio Polite
|
||||||
|
Davide Crucitti
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
- #389 Extend summary configuration
|
||||||
|
(thanks to Davide Crucitti)
|
||||||
- #489 First execution creates database regardless of confirmation response
|
- #489 First execution creates database regardless of confirmation response
|
||||||
(thanks to Rafael Oliveira)
|
(thanks to Rafael Oliveira)
|
||||||
- #403 Remove incorrect output stating that an empty interval was recorded
|
- #403 Remove incorrect output stating that an empty interval was recorded
|
||||||
|
|
|
@ -47,6 +47,14 @@ Set the date range for the summary report.
|
||||||
The value has to be a range hint, see timew-hints(7).
|
The value has to be a range hint, see timew-hints(7).
|
||||||
Default value is ':day'
|
Default value is ':day'
|
||||||
|
|
||||||
|
**reports.summary.weekdays**::
|
||||||
|
Determines whether the weekday column is shown in the summary.
|
||||||
|
Default value is 'yes'
|
||||||
|
|
||||||
|
**reports.summary.weeks**::
|
||||||
|
Determines whether the week column is shown in the summary.
|
||||||
|
Default value is 'yes'
|
||||||
|
|
||||||
**tags.**__<tag>__**.color**::
|
**tags.**__<tag>__**.color**::
|
||||||
Assigns a specific foreground and background color to a tag.
|
Assigns a specific foreground and background color to a tag.
|
||||||
Examples of valid colors include 'white', 'gray8', 'black on yellow', and 'rgb345'.
|
Examples of valid colors include 'white', 'gray8', 'black on yellow', and 'rgb345'.
|
||||||
|
|
|
@ -95,28 +95,46 @@ int CmdSummary (
|
||||||
const auto date_fmt = "Y-M-D";
|
const auto date_fmt = "Y-M-D";
|
||||||
const auto time_fmt = "h:N:S";
|
const auto time_fmt = "h:N:S";
|
||||||
|
|
||||||
|
const auto show_weeks = rules.getBoolean ("reports.summary.weeks", true);
|
||||||
|
const auto show_weekdays = rules.getBoolean ("reports.summary.weekdays", true);
|
||||||
const auto show_ids = cli.getComplementaryHint ("ids", rules.getBoolean ("reports.summary.ids"));
|
const auto show_ids = cli.getComplementaryHint ("ids", rules.getBoolean ("reports.summary.ids"));
|
||||||
const auto show_tags = cli.getComplementaryHint ("tags", rules.getBoolean ("reports.summary.tags", true));
|
const auto show_tags = cli.getComplementaryHint ("tags", rules.getBoolean ("reports.summary.tags", true));
|
||||||
const auto show_annotations = cli.getComplementaryHint ("annotations", rules.getBoolean ("reports.summary.annotations"));
|
const auto show_annotations = cli.getComplementaryHint ("annotations", rules.getBoolean ("reports.summary.annotations"));
|
||||||
const auto show_holidays = cli.getComplementaryHint ("holidays", rules.getBoolean ("reports.summary.holidays"));
|
const auto show_holidays = cli.getComplementaryHint ("holidays", rules.getBoolean ("reports.summary.holidays"));
|
||||||
|
|
||||||
const auto tags_col_offset = show_ids ? 1 : 0;
|
const auto dates_col_offset = show_weeks ? 1 : 0;
|
||||||
|
const auto weekdays_col_offset = dates_col_offset;
|
||||||
|
const auto ids_col_offset = weekdays_col_offset + (show_weekdays ? 1: 0);
|
||||||
|
const auto tags_col_offset = ids_col_offset + (show_ids ? 1 : 0);
|
||||||
const auto annotation_col_offset = tags_col_offset + (show_tags ? 1 : 0);
|
const auto annotation_col_offset = tags_col_offset + (show_tags ? 1 : 0);
|
||||||
const auto start_col_offset = annotation_col_offset + (show_annotations ? 1 : 0);
|
const auto start_col_offset = annotation_col_offset + (show_annotations ? 1 : 0);
|
||||||
|
|
||||||
const auto tags_col_index = 3 + tags_col_offset;
|
const auto weeks_col_index = 0;
|
||||||
const auto annotation_col_index = 3 + annotation_col_offset;
|
const auto dates_col_index = 0 + dates_col_offset;
|
||||||
const auto start_col_index = 3 + start_col_offset;
|
const auto weekdays_col_index = 1 + weekdays_col_offset;
|
||||||
const auto end_col_index = 4 + start_col_offset;
|
const auto ids_col_index = 1 + ids_col_offset;
|
||||||
const auto duration_col_index = 5 + start_col_offset;
|
const auto tags_col_index = 1 + tags_col_offset;
|
||||||
const auto total_col_index = 6 + start_col_offset;
|
const auto annotation_col_index = 1 + annotation_col_offset;
|
||||||
|
const auto start_col_index = 1 + start_col_offset;
|
||||||
|
const auto end_col_index = 2 + start_col_offset;
|
||||||
|
const auto duration_col_index = 3 + start_col_offset;
|
||||||
|
const auto total_col_index = 4 + start_col_offset;
|
||||||
|
|
||||||
Table table;
|
Table table;
|
||||||
table.width (1024);
|
table.width (1024);
|
||||||
table.colorHeader (Color ("underline"));
|
table.colorHeader (Color ("underline"));
|
||||||
table.add ("Wk");
|
|
||||||
|
if (show_weeks)
|
||||||
|
{
|
||||||
|
table.add ("Wk");
|
||||||
|
}
|
||||||
|
|
||||||
table.add ("Date");
|
table.add ("Date");
|
||||||
table.add ("Day");
|
|
||||||
|
if (show_weekdays)
|
||||||
|
{
|
||||||
|
table.add ("Day");
|
||||||
|
}
|
||||||
|
|
||||||
if (show_ids)
|
if (show_ids)
|
||||||
{
|
{
|
||||||
|
@ -170,9 +188,18 @@ int CmdSummary (
|
||||||
|
|
||||||
if (day != previous)
|
if (day != previous)
|
||||||
{
|
{
|
||||||
table.set (row, 0, format (week_fmt, day.week ()));
|
if (show_weeks)
|
||||||
table.set (row, 1, day.toString (date_fmt));
|
{
|
||||||
table.set (row, 2, Datetime::dayNameShort (day.dayOfWeek ()));
|
table.set (row, weeks_col_index, format (week_fmt, day.week ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
table.set (row, dates_col_index, day.toString (date_fmt));
|
||||||
|
|
||||||
|
if (show_weekdays)
|
||||||
|
{
|
||||||
|
table.set (row, weekdays_col_index, Datetime::dayNameShort (day.dayOfWeek ()));
|
||||||
|
}
|
||||||
|
|
||||||
previous = day;
|
previous = day;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +217,7 @@ int CmdSummary (
|
||||||
|
|
||||||
if (show_ids)
|
if (show_ids)
|
||||||
{
|
{
|
||||||
table.set (row, 3, format ("@{1}", track.id), colorID);
|
table.set (row, ids_col_index, format ("@{1}", track.id), colorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_tags)
|
if (show_tags)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue