cartos 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -20,15 +20,15 @@ module Cartos
|
|
20
20
|
totals["expendings"] = {}
|
21
21
|
totals["earnings"] = {}
|
22
22
|
totals["total"] = {}
|
23
|
-
entries.each_month do |month,
|
23
|
+
entries.each_month do |month, month_entries|
|
24
24
|
totals["expendings"][month] = 0
|
25
25
|
totals["earnings"][month] = 0
|
26
|
-
|
26
|
+
month_entries.each do |entry|
|
27
27
|
entry.amount < 0 ? totals["expendings"][month] += entry.amount : totals["earnings"][month] += entry.amount
|
28
28
|
end
|
29
29
|
totals["total"][month] = totals["earnings"][month] + totals["expendings"][month]
|
30
30
|
totals["expendings"][month] = totals["expendings"][month]
|
31
|
-
|
31
|
+
month_entries.each_category do |category, elements|
|
32
32
|
categories[category] ||= {}
|
33
33
|
categories[category][month] = elements.inject(0) {|total, element| total += element.amount}
|
34
34
|
end
|
@@ -25,9 +25,9 @@ module Cartos
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def push_summnary(start_row, type_column, elements)
|
28
|
-
push_months start_row, elements.values.map {|v| v.keys}.flatten.uniq
|
28
|
+
push_months start_row, elements.values.map {|v| v.keys}.flatten.uniq.sort.sort
|
29
29
|
elements.each do |element, months|
|
30
|
-
row,
|
30
|
+
row, _ = push_row type_column, element
|
31
31
|
months.each do |month, amount|
|
32
32
|
push_month_amount month, row, amount
|
33
33
|
end
|
data/lib/cartos/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -203,12 +203,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
203
|
- - ! '>='
|
204
204
|
- !ruby/object:Gem::Version
|
205
205
|
version: '0'
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
hash: -1151734629145509953
|
206
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
210
|
none: false
|
208
211
|
requirements:
|
209
212
|
- - ! '>='
|
210
213
|
- !ruby/object:Gem::Version
|
211
214
|
version: '0'
|
215
|
+
segments:
|
216
|
+
- 0
|
217
|
+
hash: -1151734629145509953
|
212
218
|
requirements: []
|
213
219
|
rubyforge_project:
|
214
220
|
rubygems_version: 1.8.24
|