pocket-console 0.1.1 → 0.1.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/lib/tagStats.rb +123 -25
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9462ed79543a81340ba18c92b26bc53c0e5894f1
4
- data.tar.gz: 36eec9846fd09c488c3911f369c50a99cb55ae16
3
+ metadata.gz: 65c06e806cd4e4aeac76308e1b6d07eea8e76e73
4
+ data.tar.gz: 5cea7ac4f6698f08d120eb74adc2e5ef7c204004
5
5
  SHA512:
6
- metadata.gz: 2e493c20755293ff0343a64e75b503c43104380b15f0c78473d172f083c7aabc604fa1df9dad64ffb3a4c1bd65be49bf382b96369e6dcc801498d89460561795
7
- data.tar.gz: 4ca7a5689196699a57470e8cfd0ddb42820de437c24904b7d894059fa08e3b42415f5277348e1353a951421c407af3dfe2bd0548afb35e3b75816a916731b62a
6
+ metadata.gz: de946cfddc39e65af2fca0991b951f38d533381b01d7ad4a3d96eee524014fdd5f5d29e76704bffad5148536348529d6110cfbe2900b219fa70da7a9e383d2a0
7
+ data.tar.gz: 99be703c72c783ab7912f6d21e7ab41ca9b08b8af0d46af9e2477a12b3d7f27d8ebe7b029869f47ed20c50874d35a00dd9936951bae071227b268e68cb1f1e2e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 0.1.2
2
+
3
+ * Added 'Less Unread'. Tags that are associated to the lowest amount of unread items.
4
+
5
+ # 0.1.1
6
+
7
+ * Added 'Less Used Tags'
8
+
1
9
  # 0.1.0
2
10
 
3
11
  * Added read percentage for General Stats
data/lib/tagStats.rb CHANGED
@@ -10,6 +10,8 @@ class TagStats
10
10
  printLessUsed
11
11
  puts ''
12
12
  printMostUnread
13
+ puts ''
14
+ printLessUnread
13
15
  end
14
16
 
15
17
  def printMostUsed
@@ -17,7 +19,7 @@ class TagStats
17
19
  puts '================================='
18
20
  puts ' Tag Stats - Most Used '
19
21
  puts '---------------------------------'
20
- printTopTable
22
+ printMostUsedUntilChange(10)
21
23
  puts '================================='
22
24
  end
23
25
 
@@ -26,34 +28,64 @@ class TagStats
26
28
  puts '================================='
27
29
  puts ' Tag Stats - Less Used '
28
30
  puts '---------------------------------'
29
- printUntilTable
31
+ printLessUsedUntilChange(3)
30
32
  puts '================================='
31
33
  end
32
34
 
33
- def printTopTable
34
-
35
+ def printMostUnread
36
+ @tags = @tags.sort_by{|_key, stats| stats['unread']}.reverse!
37
+ puts '================================='
38
+ puts ' Tag Stats - Most Unread '
39
+ puts '---------------------------------'
40
+ printMostUnreadUntilChange(10)
41
+ puts '================================='
42
+ end
43
+
44
+ def printLessUnread
45
+ @tags = @tags.sort_by{|_key, stats| stats['unread']}
46
+ puts '================================='
47
+ puts ' Tag Stats - Less Unread '
48
+ puts '---------------------------------'
49
+ printLessUnreadUntilChange(3)
50
+ puts '================================='
51
+ end
52
+
53
+
54
+ def printMostUsedUntilChange(changes)
55
+
35
56
  puts sprintf "%-13s | %6s | %7s", 'tag', 'total', 'unread'
36
57
  puts '---------------------------------'
37
- top_count = 0
58
+
59
+ changeCount = 0
60
+ firstLoop = true
61
+ prevCount = 0
38
62
 
39
63
  @tags.each do |tag, stats|
40
-
41
- count = stats['count']
42
- unread = stats['unread']
43
- puts sprintf "%-13s | %6d | %7d", tag, count, unread
44
64
 
45
- top_count += 1
65
+ if (firstLoop)
66
+ prevCount = stats['count']
67
+ firstLoop = false
68
+ end
46
69
 
47
- if (top_count == 5)
48
- break
70
+ count = stats['count']
71
+ if (count < prevCount)
72
+ changeCount += 1
73
+ if (changeCount == changes)
74
+ break
75
+ end
49
76
  end
77
+ prevCount = stats['count']
78
+
79
+ unread = stats['unread']
80
+ puts sprintf "%-13s | %6d | %7d", tag, count, unread
50
81
 
51
82
  end
52
83
 
53
84
  end
54
85
 
55
- def printUntilTable
56
-
86
+
87
+ def printLessUsedUntilChange(changes)
88
+
57
89
  puts sprintf "%-13s | %6s | %7s", 'tag', 'total', 'unread'
58
90
  puts '---------------------------------'
59
91
 
@@ -65,7 +97,7 @@ class TagStats
65
97
  count = stats['count']
66
98
  if (count > prevCount)
67
99
  changeCount += 1
68
- if (changeCount == 4)
100
+ if (changeCount == changes)
69
101
  break
70
102
  end
71
103
  end
@@ -78,22 +110,88 @@ class TagStats
78
110
 
79
111
  end
80
112
 
81
- def printMostUnread
82
- @tags = @tags.sort_by{|_key, stats| stats['unread']}.reverse!
83
- puts '================================='
84
- puts ' Tag Stats - Most Unread '
85
- puts '---------------------------------'
86
- puts sprintf "%-13s | %7s | %6s", 'tag', 'unread', 'total'
113
+
114
+ def printMostUnreadUntilChange(changes)
115
+
116
+ puts sprintf "%-13s | %6s | %7s", 'tag', 'unread', 'total'
87
117
  puts '---------------------------------'
118
+
119
+ changeCount = 0
120
+ firstLoop = true
121
+ prevCount = 0
122
+
88
123
  @tags.each do |tag, stats|
124
+
125
+ if (firstLoop)
126
+ prevCount = stats['unread']
127
+ firstLoop = false
128
+ end
129
+
89
130
  unread = stats['unread']
90
- if unread == 1
91
- break
131
+ if (unread < prevCount)
132
+ changeCount += 1
133
+ if (changeCount == changes)
134
+ break
135
+ end
92
136
  end
137
+ prevCount = stats['unread']
138
+
93
139
  count = stats['count']
94
- puts sprintf "%-13s | %7d | %6d", tag, unread, count
140
+ puts sprintf "%-13s | %6d | %7d", tag, unread, count
141
+
95
142
  end
96
- puts '================================='
143
+
144
+ end
145
+
146
+
147
+ def printLessUnreadUntilChange(changes)
148
+
149
+ puts sprintf "%-13s | %6s | %7s", 'tag', 'unread', 'total'
150
+ puts '---------------------------------'
151
+
152
+ changeCount = 0
153
+ prevCount = 0
154
+
155
+ @tags.each do |tag, stats|
156
+
157
+ unread = stats['unread']
158
+ if (unread > prevCount)
159
+ changeCount += 1
160
+ if (changeCount == changes)
161
+ break
162
+ end
163
+ end
164
+ prevCount = stats['unread']
165
+
166
+ count = stats['count']
167
+ puts sprintf "%-13s | %6d | %7d", tag, unread, count
168
+
169
+ end
170
+
171
+ end
172
+
173
+
174
+ def printTopTable
175
+
176
+ puts sprintf "%-13s | %6s | %7s", 'tag', 'total', 'unread'
177
+ puts '---------------------------------'
178
+ top_count = 0
179
+
180
+ @tags.each do |tag, stats|
181
+
182
+ count = stats['count']
183
+ unread = stats['unread']
184
+ puts sprintf "%-13s | %6d | %7d", tag, count, unread
185
+
186
+ top_count += 1
187
+
188
+ if (top_count == 10)
189
+ break
190
+ end
191
+
192
+ end
193
+
97
194
  end
98
195
 
196
+
99
197
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pocket-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Cedillo