Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding weight and retweeted_at cols to user.

  • Loading branch information...
commit 88c408e8281df3503c72b39d65c094c23d191c5a 1 parent db67115
@gleuch authored
Showing with 9 additions and 6 deletions.
  1. +7 −6 retweet.rb
  2. +2 −0  user.rb
View
13 retweet.rb
@@ -7,7 +7,7 @@
configure do
- %w(dm-core dm-types dm-aggregates dm-timestamps dm-ar-finders user tweet).each{ |lib| require lib }
+ %w(dm-core dm-types dm-validations dm-aggregates dm-timestamps dm-ar-finders user tweet).each{ |lib| require lib }
ROOT = File.expand_path(File.dirname(__FILE__))
configatron.configure_from_yaml("#{ROOT}/settings.yml", :hash => Sinatra::Application.environment.to_s)
@@ -62,11 +62,12 @@ def launch_retweet_hell(msg=false)
retweet = retweet.gsub(/\%s/, (info['status']['text'])[0, (142-retweet.length) ])
@tweet = Tweet.create(:account_id => user.account_id, :screen_name => user.screen_name, :tweet_id => info['status']['id'], :tweet => info['status']['text'], :retweet => retweet, :sent_at => Time.now) rescue nil
+ user.update_attributes(:retweeted_at => Time.now)
break
end
else
- # Fucking get rid of the user if they don't validate...
- user.destroy
+ # Get rid of the user if they don't validate...
+ user.update_attributes(:active => false)
end
end
end
@@ -94,8 +95,8 @@ def launch_retweet_hell(msg=false)
end
else
- # Fucking get rid of the user if they don't validate...
- user.destroy
+ # Get rid of the user if they don't validate...
+ user.update_attributes(:active => false)
end
end
else
@@ -204,7 +205,7 @@ def user_profile_url(screen_name, at=true)
end
@user = User.first_or_create(:account_id => info['id'])
- @user.update_attributes(:account_id => info['id'], :screen_name => info['screen_name'], :oauth_token => @access_token.token, :oauth_secret => @access_token.secret)
+ @user.update_attributes(:active => true, :account_id => info['id'], :screen_name => info['screen_name'], :oauth_token => @access_token.token, :oauth_secret => @access_token.secret)
# Set and clear session data
session[:user] = @user.id
View
2  user.rb
@@ -6,6 +6,8 @@ class User
property :screen_name, String
property :oauth_token, String
property :oauth_secret, String
+ property :weight, Integer, :default => 0
+ property :retweeted_at, DateTime
property :active, Boolean, :default => true
property :created_at, DateTime
property :updated_at, DateTime
Please sign in to comment.
Something went wrong with that request. Please try again.