twstats 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0589a754ec65039304f94cd58dc6339829ee2485bf7a2e782de8ca3e9186ba9a'
4
- data.tar.gz: 689f96336353325219a3ed14317e3de8206de93dc975e230afd7feebf0a844aa
3
+ metadata.gz: e126990ce8c73929882e7246c5a77cce582c46fd115b4241b71f12b17e1e6f6b
4
+ data.tar.gz: 9184395243e7c2b7305248e724027eca9c84cab170cc6b742bdb0a893e484b69
5
5
  SHA512:
6
- metadata.gz: b1a24c4cffc2df2f36ecaabbe5873966664dd94f40be6dbfba5d2f9a8de04876a139edc0ac6912a65de4b0a38102b26dceb2ebbe2ec5e1b72c407c786410f218
7
- data.tar.gz: 3c09c2ead64c69a666f1da1c7ae2d2ea6971c1c3c45ebc2509aa026cfb237f601d9cd2592b61df53ec845f2e7bbc7ae36573787895ba8aa6fba2c7141d95fae3
6
+ metadata.gz: 97271cf581f7b696aa23be141ddc3800fe42089803ba999f32f74b0ef9e37bd0577bf55c5bf8ee4e81d1b5257e009725d20f7e9b96db33a2b6390a7d5c5c2cbc
7
+ data.tar.gz: 9fa944b7a95d245a9c285196893549b2d6f6f804406003d98ccac50878117160b345b31fbd07f13e8ce9473683ecf6fdc0ccc8d9d02dd66dcaaec222476a96fe
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twstats (0.2.4.pre.6.pre.g29c9d57)
4
+ twstats (0.2.5)
5
5
  descriptive-statistics (>= 2.2.0)
6
6
  rainbow (~> 3.0)
7
7
  tty-prompt (~> 0.17)
@@ -2,4 +2,4 @@
2
2
 
3
3
  require "twstats"
4
4
 
5
- Twstats::Runner.new
5
+ Twstats::Runner.new ARGV[0]
@@ -17,12 +17,12 @@ module Twstats
17
17
  {name: 'Tags', value: :tags},
18
18
  {name: 'Tasks', value: :tasks},
19
19
  {name: 'Full stats', value: :fullstats},
20
- {name: 'Weekly', value: :weekly},
21
20
  {name: 'Back', value: :back}
22
21
  ]
23
22
  MENU_CHOICES = [
24
23
  {name: 'Stats', value: :stats},
25
- {name: 'Billing', value: :billing},
24
+ {name: 'TimeSheet', value: :billing},
25
+ {name: 'Weekly', value: :weekly},
26
26
  {name: 'Quit', value: :quit}
27
27
  ]
28
28
  end
@@ -54,7 +54,6 @@ module Twstats
54
54
  else
55
55
  return -99999
56
56
  end
57
- puts "bill: #{billable}, nonbill: #{non_billable}"
58
57
  if filter_billable
59
58
  return [billable, non_billable]
60
59
  else
@@ -11,9 +11,8 @@ module Twstats
11
11
  @prompt = TTY::Prompt.new
12
12
  puts WELLCOME_MESSAGE.bright
13
13
  # Ask for the csv file
14
- file ||= @prompt.ask('Specify the CSV file from a Teamwork time log export', default: 'exportTimeLog.csv') do |input|
15
- input.modify :chomp
16
- end
14
+ file = read_file file
15
+ # Check if the file exists
17
16
  @csv = CSVReader.new(file)
18
17
  loop do
19
18
  option = @prompt.select("Choose an option", Twstats::MENU_CHOICES, cycle: true)
@@ -22,12 +21,38 @@ module Twstats
22
21
  show_stats_menu
23
22
  when :billing
24
23
  billing
24
+ when :weekly
25
+ show_weekly_report
25
26
  when :quit
26
27
  break
27
28
  else
28
29
  puts 'Option not recognized!'
29
30
  end
30
31
  end
32
+ @current = nil
33
+ end
34
+
35
+ def read_file(file = nil)
36
+ # Check if the file exsis
37
+ unless file.nil?
38
+ if File.exists? file
39
+ return file
40
+ else
41
+ file = @prompt.ask('The file you have supplied does not exsists. Try again or type .q to exit twstats.') do |input|
42
+ input.modify :chomp
43
+ end
44
+ if file == ".q"
45
+ exit 0
46
+ else
47
+ read_file file
48
+ end
49
+ end
50
+ end
51
+ # Now ask for the file if needed
52
+ file = @prompt.ask('Specify the CSV file from a Teamwork time log export', default: 'exportTimeLog.csv') do |input|
53
+ input.modify :chomp
54
+ end
55
+ read_file file
31
56
  end
32
57
 
33
58
  def billing
@@ -44,8 +69,6 @@ module Twstats
44
69
  show_stats option
45
70
  when :fullstats
46
71
  show_full_stats
47
- when :weekly
48
- show_weekly_report
49
72
  when :back
50
73
  return
51
74
  else
@@ -59,7 +82,14 @@ module Twstats
59
82
  toshow = {}
60
83
  max = 0
61
84
  filter_billable ||= @prompt.yes?('Do you want to filter billable and non-billable time?', default: true)
62
- @csv.send(obj).each do |element|
85
+ objects = @csv.send(obj)
86
+ if objects.size > 1
87
+ list = @prompt.multi_select "Which ones of the following do you want to see? Select or unselect them with the space key\n" do |menu|
88
+ menu.choices objects
89
+ menu.default *[*1..objects.size]
90
+ end
91
+ end
92
+ list.each do |element|
63
93
  toshow[element] = @csv.get_total_time(obj, element, filter_billable)
64
94
  max = element.size if max < element.size
65
95
  end
@@ -76,6 +106,7 @@ module Twstats
76
106
  end
77
107
  end
78
108
  show_not_tagged_section false
109
+ # Further filtering
79
110
  end
80
111
 
81
112
  def ranking_from_not_tagged(list)
@@ -145,7 +176,7 @@ module Twstats
145
176
  def show_not_tagged_section(table)
146
177
  not_tagged = @csv.not_tagged_tasks
147
178
  unless not_tagged[:list].empty?
148
- section("Tasks not tagged in this report")
179
+ section("Logs not tagged in this report")
149
180
  puts "A total of #{not_tagged[:list].size} logs have not been tagged:"
150
181
  puts " - A total time of #{not_tagged[:total_time]} is not tagged properly."
151
182
  puts " - Impact by employee: "
@@ -178,7 +209,7 @@ module Twstats
178
209
  return
179
210
  end
180
211
  end
181
- hours = @prompt.ask 'What is the weekly amount of hours worked?', default: 40, convert: :float
212
+ hours = @prompt.ask 'What is the weekly amount of hours worked?', default: 40, convert: :int
182
213
  info = {}
183
214
  @csv.people.each do |person|
184
215
  billable, non_billable = @csv.get_total_time(:people, person, true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - J.P. Araque
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-06 00:00:00.000000000 Z
11
+ date: 2018-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler