recognition 0.8.3 → 0.8.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.
@@ -25,6 +25,10 @@ module Recognition
25
25
  Recognition.backend.hget("recognition:#{hash}", key).to_i
26
26
  end
27
27
 
28
+ def self.get_user_counter id, key
29
+ get_counter "user:#{id}:counters", key
30
+ end
31
+
28
32
  def self.update_points object, action, condition
29
33
  condition[:bucket] ||= "#{ object.class.to_s.camelize }:#{ action }"
30
34
  user = Recognition::Parser.parse_recognizable(object, condition[:recognizable], condition[:proc_params])
@@ -9,7 +9,7 @@ module Recognition
9
9
  end
10
10
 
11
11
  def recognition_counter bucket
12
- Recognition::Database.get_counter "user:#{ self.id }:counters", bucket
12
+ Recognition::Database.get_user_counter self.id, bucket
13
13
  end
14
14
 
15
15
  def add_initial_points
@@ -31,6 +31,7 @@ module Recognition
31
31
  else
32
32
  # has the redeemable ever been redeemed?
33
33
  if transactions.any?
34
+ Recognition.log 'debug', get_user_counter(recognizable.id)
34
35
  # has the redeemable ever been redeemed by this user?
35
36
  if get_user_counter(recognizable.id) != 0
36
37
  Recognition.log self.class.to_s.downcase.to_sym, "validation error for #{self.class.to_s}##{self.id}: user has already redeemed the voucher"
@@ -81,7 +82,7 @@ module Recognition
81
82
  end
82
83
 
83
84
  def get_user_counter id
84
- Recognition::Database.get_counter "user:#{id}", bucket
85
+ Recognition::Database.get_user_counter id, bucket
85
86
  end
86
87
 
87
88
  def transactions page = 0, per = 20
@@ -1,4 +1,4 @@
1
1
  module Recognition
2
2
  # Current Version
3
- VERSION = "0.8.3"
3
+ VERSION = "0.8.4"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recognition
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
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-06-01 00:00:00.000000000 Z
12
+ date: 2013-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  segments:
186
186
  - 0
187
- hash: -2859555224088050591
187
+ hash: -3675968338327744013
188
188
  required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  none: false
190
190
  requirements:
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  segments:
195
195
  - 0
196
- hash: -2859555224088050591
196
+ hash: -3675968338327744013
197
197
  requirements: []
198
198
  rubyforge_project:
199
199
  rubygems_version: 1.8.23