moneybook 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/moneybook +8 -4
  3. data/moneybook.gemspec +1 -1
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -93,7 +93,8 @@ def get_final(sq, people)
93
93
  final = {}
94
94
  spent = {}
95
95
  given = {}
96
- people.each{|person| final[person]=0;spent[person]=0;given[person]=0}
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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{moneybook}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["luca cioria"]
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: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - luca cioria