lib/osm/api.rb in osm-0.0.22 vs lib/osm/api.rb in osm-0.0.23
- old
+ new
@@ -626,10 +626,11 @@
if !options[:no_cache] && cache_exist?(cache_key) && self.user_can_access?(:badge, section_id)
return cache_read(cache_key)
end
data = perform_query("challenges.php?action=getInitialBadges&type=core§ionid=#{section_id}§ion=#{section_type}&termid=#{term_id}")
- data = (data['stock'] || {}).select{ |k,v| !k.eql?('sectionid') }
+ data = (data['stock'] || {}).select{ |k,v| !k.eql?('sectionid') }.
+ inject({}){ |new_hash,(badge, level)| new_hash[badge] = level.to_i; new_hash }
self.user_can_access :badge, section_id
cache_write(cache_key, data, :expires_in => @@default_cache_ttl)
return data
end