Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rake tasks to update retweet/favorite count and tweeter's profile image #9

Open
O-I opened this issue Apr 21, 2014 · 2 comments
Open

Comments

@O-I
Copy link
Owner

O-I commented Apr 21, 2014

It would be nice — but not necessary — to see current retweet and favorite counts for tweets I've favorited. In some cases, I'm one of the first people to favorite a tweet. I'd like to know if some of those tweets end up getting more favorites over the course of time.

Also, occasionally, people change their profile pics and that invalidates the tweeter_profile_image_url I use to render them. It would be nice to update this periodically to prevent missing assets. Additionally, I could add a default photo for when missing assets are unavailable.

@O-I
Copy link
Owner Author

O-I commented May 7, 2014

Rake task for updating profile pics completed.

@O-I
Copy link
Owner Author

O-I commented May 12, 2014

Adding a default photo for when image assets are missing seems to be impractical. Specifically, verifying response codes on each image like so if just too slow:

def profile_pic(favorite)
    url = favorite.tweeter_profile_image_url
    response_code = Net::HTTP.get_response(url).code
    profile_pic_url = response_code == '200' ? url.to_s : 'egg.png'
    image_tag profile_pic_url, class: 'fave-profile-pic'
  end

It's probably better just to have Heroku scheduler run rake pluck:update_pics daily. I might try using jQuery to replace broken images, though. (Also not worth it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant