Permalink
Browse files

First kludgy fix to support anonymous users

  • Loading branch information...
1 parent 806c43a commit d53bd5a4b95181f80d3b2058e4a91773a98bc641 @leereilly committed May 29, 2011
Showing with 7 additions and 2 deletions.
  1. +2 −1 app.rb
  2. +5 −1 views/high_scores.erb
View
@@ -133,7 +133,7 @@ def get_high_scores(user, repo)
stored_repo = Repo::create_from_username_and_repo(user, repo)
puts "Storing repo: #{stored_repo}"
- contributors_url = "http://github.com/api/v2/json/repos/show/#{user}/#{repo}/contributors"
+ contributors_url = "http://github.com/api/v2/json/repos/show/#{user}/#{repo}/contributors/anon"
contributors_feed = Net::HTTP.get_response(URI.parse(contributors_url))
contributors = contributors_feed.body
@@ -143,6 +143,7 @@ def get_high_scores(user, repo)
repository_contributors.each do |repository_contributor|
user_hash = Hash.new
user_hash[:login] = repository_contributor['login']
+ user_hash[:name] = repository_contributor['name']
user_hash[:email] = repository_contributor['email']
user_hash[:gravatar_id] = repository_contributor['gravatar_id']
user_hash[:location] = repository_contributor['location']
@@ -12,9 +12,13 @@
<tr>
<div itemscope itemtype="http://data-vocabulary.org/Person">
<td class="small"><%= high_score[:contributions]*100 %></td>
+ <% unless high_score[:login].nil? %>
<td class="small"><img itemprop="photo" src="http://0.gravatar.com/avatar/<%= high_score[:gravatar_id] %>?s=10&d=identicon" width="50" height="50"></td>
<td class="small"><span itemprop="nickname"><a href="/<%= high_score[:login] %>"><%= high_score[:login] %></a></span></td>
- </span>
+ <% else %>
+ <td class="small"><img itemprop="photo" src="http://0.gravatar.com/avatar/dummy?s=10&d=identicon" width="50" height="50"></td>
+ <td class="small"><span itemprop="name"><%= high_score[:name] %></span></td>
+ <% end %></span>
</tr>
<% end %>
</table>

1 comment on commit d53bd5a

@ojii
ojii commented on d53bd5a May 30, 2011

yay!

Please sign in to comment.