moneybook 0.2.3 → 0.2.4
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.
- data/VERSION +1 -1
- data/bin/moneybook +8 -4
- data/moneybook.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/bin/moneybook
CHANGED
@@ -93,7 +93,8 @@ def get_final(sq, people)
|
|
93
93
|
final = {}
|
94
94
|
spent = {}
|
95
95
|
given = {}
|
96
|
-
|
96
|
+
debt = {}
|
97
|
+
people.each{|person| final[person]=0;spent[person]=0;given[person]=0;debt[person]=0;}
|
97
98
|
sq.each {|c|
|
98
99
|
c[:balance].each_pair{|person, value|
|
99
100
|
final[person] += value
|
@@ -101,11 +102,14 @@ def get_final(sq, people)
|
|
101
102
|
c[:virtual].each_pair{|person, value|
|
102
103
|
spent[person] += value unless (c[:name] == 'PAYBACK' || c[:name] == 'DEBT')
|
103
104
|
}
|
105
|
+
c[:virtual].each_pair{|person, value|
|
106
|
+
debt[person] += value if (c[:name] == 'PAYBACK' || c[:name] == 'DEBT')
|
107
|
+
}
|
104
108
|
c[:true].each_pair{|person, value|
|
105
109
|
given[person] += value
|
106
110
|
}
|
107
111
|
}
|
108
|
-
[final, spent, given]
|
112
|
+
[final, spent, given, debt]
|
109
113
|
end
|
110
114
|
|
111
115
|
def command_parse(options, filename)
|
@@ -247,12 +251,12 @@ def command_parse(options, filename)
|
|
247
251
|
people_to_print = people.normalize_length
|
248
252
|
people.each_index{|i|
|
249
253
|
person = people[i]
|
250
|
-
puts "#{people_to_print[i]} #{final[0][person] == 0 ? '--- ' : (final[0][person] > 0 ? 'receives' : 'gives ')} #{"% 8.2f" % final[0][person]} spent #{"% 8.2f" % final[1][person]} given #{"% 8.2f" % final[2][person]}"
|
254
|
+
puts "#{people_to_print[i]} #{final[0][person] == 0 ? '--- ' : (final[0][person] > 0 ? 'receives' : 'gives ')} #{"% 8.2f" % final[0][person]} spent #{"% 8.2f" % final[1][person]} given #{"% 8.2f" % final[2][person]} debt #{"% 8.2f" % final[3][person]}"
|
251
255
|
}
|
252
256
|
puts "=== in converted currency (multiplying by #{currency_change}):" if currency_change > 0
|
253
257
|
people.each_index{|i|
|
254
258
|
person = people[i]
|
255
|
-
puts "#{people_to_print[i]} #{final[0][person] == 0 ? '--- ' : (final[0][person] > 0 ? 'receives' : 'gives ')} #{"% 8.2f" % (final[0][person]*currency_change)} spent #{"% 8.2f" % (final[1][person]*currency_change)} given #{"% 8.2f" % (final[2][person]*currency_change)}" if currency_change > 0
|
259
|
+
puts "#{people_to_print[i]} #{final[0][person] == 0 ? '--- ' : (final[0][person] > 0 ? 'receives' : 'gives ')} #{"% 8.2f" % (final[0][person]*currency_change)} spent #{"% 8.2f" % (final[1][person]*currency_change)} given #{"% 8.2f" % (final[2][person]*currency_change)} debt #{"% 8.2f" % final[3][person]*currency_change}" if currency_change > 0
|
256
260
|
}
|
257
261
|
end
|
258
262
|
|
data/moneybook.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moneybook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- luca cioria
|