Module: Timet::TagDistribution

Includes:
TagDistributionFormatting
Included in:
TimeReport
Defined in:
lib/timet/tag_distribution.rb

Overview

The TagDistribution module provides functionality to format and display the distribution of tags based on their durations.

Defined Under Namespace

Classes: Context

Constant Summary collapse

MAX_BAR_LENGTH =
70
BLOCK_CHAR =
'▅'
TAG_SIZE =
12

Instance Method Summary collapse

Methods included from TagDistributionFormatting

build_average_part, build_duration_part, build_major_summary, calculate_value_and_bar_length, generate_horizontal_bar, generate_stats, high_sd_message, introduction, low_sd_message, moderate_sd_message

Instance Method Details



203
204
205
206
207
208
# File 'lib/timet/tag_distribution.rb', line 203

def print_footer
  puts '-' * 45
  puts 'T:'.rjust(4).red + 'The total duration'.gray
  puts 'AVG:'.rjust(4).red + 'The average duration'.gray
  puts 'SD:'.rjust(4).red + 'The standard deviation of the durations'.gray
end

#tag_distribution(colors) ⇒ Object



192
193
194
195
196
197
198
199
200
201
# File 'lib/timet/tag_distribution.rb', line 192

def tag_distribution(colors)
  time_stats = TimeStatistics.new(@items)
  total = time_stats.total_duration

  return unless total.positive?

  ctx = Context.new(time_stats, total, colors)
  ctx.render
  print_footer
end