Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed a bug in remove_member that would remove all of the optional membe... #33

Merged
merged 1 commit into from

1 participant

@czarneckid
Owner

...r data

:facepunch:

@czarneckid czarneckid merged commit 196c179 into master
@czarneckid czarneckid deleted the fix-remove-member-removes-all-member-data branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 CHANGELOG.markdown
@@ -1,5 +1,9 @@
# CHANGELOG
+## leaderboard 3.0.1 (2012-12-19)
+
+* Fixed a bug in `remove_member` that would remove all of the optional member data.
+
## leaderboard 3.0.0 (2012-12-03)
* Added `rank_member_if` and `rank_member_if_in` methods that allow you to rank a member in the leaderboard based on execution of a lambda.
View
2  lib/leaderboard.rb
@@ -255,7 +255,7 @@ def remove_member(member)
def remove_member_from(leaderboard_name, member)
@redis_connection.multi do |transaction|
transaction.zrem(leaderboard_name, member)
- transaction.del(member_data_key(leaderboard_name), member)
+ transaction.hdel(member_data_key(leaderboard_name), member)
end
end
View
2  lib/leaderboard/version.rb
@@ -1,4 +1,4 @@
class Leaderboard
# Leaderboard version
- VERSION = '3.0.0'.freeze
+ VERSION = '3.0.1'.freeze
end
View
12 spec/leaderboard_spec.rb
@@ -659,4 +659,16 @@
@leaderboard.rank_member_if(highscore_check, 'david', 1338)
@leaderboard.score_for('david').should eql(1338.0)
end
+
+ it 'should not delete all the member data when calling remove_member' do
+ rank_members_in_leaderboard
+
+ @redis_connection.exists("name:member_data").should be_true
+ @redis_connection.hgetall("name:member_data").size.should be(5)
+ @leaderboard.total_members.should be(5)
+ @leaderboard.remove_member('member_1')
+ @redis_connection.exists("name:member_data").should be_true
+ @redis_connection.hgetall("name:member_data").size.should be(4)
+ @leaderboard.total_members.should be(4)
+ end
end
View
2  spec/version_spec.rb
@@ -2,6 +2,6 @@
describe 'Leaderboard::VERSION' do
it 'should be the correct version' do
- Leaderboard::VERSION.should == '3.0.0'
+ Leaderboard::VERSION.should == '3.0.1'
end
end
Something went wrong with that request. Please try again.