diff --git a/AUTHORS b/AUTHORS index 045024e5..2ffa2957 100644 --- a/AUTHORS +++ b/AUTHORS @@ -105,3 +105,4 @@ Thanks to the following, who submitted detailed bug reports and excellent sugges squirrellyDave Edd Salkield Oivvio Polite + Davide Crucitti diff --git a/ChangeLog b/ChangeLog index 41d77846..6d0e14f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +- #389 Extend summary configuration + (thanks to Davide Crucitti) - #489 First execution creates database regardless of confirmation response (thanks to Rafael Oliveira) - #403 Remove incorrect output stating that an empty interval was recorded diff --git a/doc/man1/timew-summary.1.adoc b/doc/man1/timew-summary.1.adoc index cff2eecc..b42fb200 100644 --- a/doc/man1/timew-summary.1.adoc +++ b/doc/man1/timew-summary.1.adoc @@ -47,6 +47,14 @@ Set the date range for the summary report. The value has to be a range hint, see timew-hints(7). 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.**____**.color**:: Assigns a specific foreground and background color to a tag. Examples of valid colors include 'white', 'gray8', 'black on yellow', and 'rgb345'. diff --git a/src/commands/CmdSummary.cpp b/src/commands/CmdSummary.cpp index c6cdadeb..9bdc2835 100644 --- a/src/commands/CmdSummary.cpp +++ b/src/commands/CmdSummary.cpp @@ -95,28 +95,46 @@ int CmdSummary ( const auto date_fmt = "Y-M-D"; 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_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_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 start_col_offset = annotation_col_offset + (show_annotations ? 1 : 0); - const auto tags_col_index = 3 + tags_col_offset; - const auto annotation_col_index = 3 + annotation_col_offset; - const auto start_col_index = 3 + start_col_offset; - const auto end_col_index = 4 + start_col_offset; - const auto duration_col_index = 5 + start_col_offset; - const auto total_col_index = 6 + start_col_offset; + const auto weeks_col_index = 0; + const auto dates_col_index = 0 + dates_col_offset; + const auto weekdays_col_index = 1 + weekdays_col_offset; + const auto ids_col_index = 1 + ids_col_offset; + const auto tags_col_index = 1 + tags_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.width (1024); table.colorHeader (Color ("underline")); - table.add ("Wk"); + + if (show_weeks) + { + table.add ("Wk"); + } + table.add ("Date"); - table.add ("Day"); + + if (show_weekdays) + { + table.add ("Day"); + } if (show_ids) { @@ -170,9 +188,18 @@ int CmdSummary ( if (day != previous) { - table.set (row, 0, format (week_fmt, day.week ())); - table.set (row, 1, day.toString (date_fmt)); - table.set (row, 2, Datetime::dayNameShort (day.dayOfWeek ())); + if (show_weeks) + { + 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; } @@ -190,7 +217,7 @@ int CmdSummary ( 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)