Created
August 30, 2011 16:15
-
-
Save levicook/1181270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reseller.demo.as_current do # So that factories are happy. | |
reseller = Reseller.current | |
# == Posture People | |
aaron = reseller.users.find_by_email('[email protected]') || reseller.users.new | |
aaron.display_name = 'Aaron Smith' | |
aaron.email = '[email protected]' | |
aaron.password = aaron.password_confirmation = 'joinhere' | |
aaron.save! if aaron.changed? | |
# Create the business and business_profile | |
# ======================================= | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') || Business.new | |
ppl.reseller = reseller | |
ppl.display_name = 'Posture People' | |
ppl.save! if ppl.changed? | |
Image.create!(:file_name => File.open('public/images/tmp/molda.jpg'), :entity => ppl) if ppl.image.blank? | |
business_profile = ppl.business_profile || ppl.build_business_profile | |
business_profile.tagline = 'Where Posture Matters' | |
business_profile.street_1 = '529 US Rte #1' | |
business_profile.street_2 = 'Suite 4' | |
business_profile.city = 'York' | |
business_profile.province = Province::ME | |
business_profile.postalcode = '03909' | |
business_profile.phone_number = '2073635656' | |
business_profile.website = 'http://posturepeople.com/' | |
business_profile.about = File.read('db/molda_about.txt') | |
business_profile.save! if business_profile.changed? | |
ppl.users.managers.include?(aaron) || ppl.create_manager!(aaron) | |
# Create a twitter profile | |
# ======================= | |
if Rails.env.redux? || Rails.env.demo? | |
twitter_profile = ppl.twitter_profiles.find_by_twitter_user_id('247517250') || ppl.twitter_profiles.new(:twitter_user_id => '247517250') | |
twitter_profile.screen_name = 'posturepeople' | |
twitter_profile.oauth_token = '247517250-NkBd0udMg9ldAIBtlcFtUFCX63rZtieavG98qG9s' | |
twitter_profile.oauth_secret = 'JHCYyakUhlHGLyjjTW3FWZ6R2fqwaCeNl14lAr8Y0' | |
twitter_profile.save! if twitter_profile.changed? | |
end | |
if Rails.env.development? || Rails.env.test? || Rails.env.gate? | |
twitter_profile = ppl.twitter_profiles.find_by_twitter_user_id('288063055') || ppl.twitter_profiles.new(:twitter_user_id => '288063055') | |
twitter_profile.screen_name = 'JoinLocalTester' | |
twitter_profile.oauth_token = '288063055-zwPsoVIWCBpoMgNwwLmCUnVOJ668cV6IMJcPbRSp' | |
twitter_profile.oauth_secret = 'bswDMn3e7vsujmTllN0OESWqdyIUPwssQrkRIuoLg' | |
twitter_profile.save! if twitter_profile.changed? | |
end | |
end | |
# Create facebook profiles | |
# ======================================= | |
Dir["db/seeds/facebook/#{reseller.facebook_application.app_id}/*.yml"].each do |fb_config| | |
friendly_id = File.basename(fb_config, '.yml') | |
business = Business.find(friendly_id) | |
next if business.created_by.facebook_profile.present? | |
fb_config = YAML.load(open(fb_config)) | |
FacebookProfile.transaction do | |
business.created_by.as_current do | |
facebook_profile = business.created_by.build_facebook_profile(:auth_token => fb_config['profile']['auth_token']) | |
facebook_profile.save! | |
fb_config['pages'].each do |page_config| | |
next if business.facebook_pages.find_by_page_id(page_config['page_id']) | |
business.facebook_pages.create!({ | |
:facebook_profile => facebook_profile, | |
:auth_token => page_config['auth_token'], | |
:link => page_config['link'], | |
:name => page_config['name'], | |
:page_id => page_config['page_id'], | |
:has_added_app => true, | |
}) | |
end | |
end | |
end | |
end | |
# Default join reward | |
# ======================================= | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
default_join_reward = ppl.default_join_reward || ppl.build_default_join_reward | |
default_join_reward.name = "10% off your next visit" | |
default_join_reward.headline = "10% off your next visit" | |
default_join_reward.details = "As a thank you for Joining our Connection Network get 10% off your next visit. This can be used for chiropractic treatment or massage treatment. Just print and bring in this reward on your next visit to Posture People." | |
default_join_reward.fine_print = "Reward is not transferable to another party. Must present printed reward at the time of service." | |
default_join_reward.start_date = today | |
default_join_reward.save! if default_join_reward.changed? | |
end | |
# Setup a default referral reward (ignoring targeting right now :/ ) | |
# ======================================= | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
referral_reward = ppl.referral_rewards.find_by_name('Default Referral Reward') || ppl.referral_rewards.build(:name => 'Default Referral Reward') | |
referral_reward.headline = 'Free 60 minute massage.' | |
referral_reward.details = "Thank you for your referral. Relax and get a massage on us. Just reference this reward when you make your appointment, bring in the printed reward and you'll receive a complementary 1 hour massage." | |
referral_reward.start_date = today | |
referral_reward.fine_print = "Reward is not transferable to another party. Must present printed reward at the time of service. Reward is only valid for single use. Cannot be combined with other offers. Does not include any applicable taxes. Appointments require 24 cancellation notice. Failure to provide notice will result in standard office charges for the time allotted." | |
referral_reward.default = true | |
referral_reward.save! if referral_reward.changed? | |
# TODO Give this some publishing history :/ | |
end | |
# Setup a review reward (ignoring targeting here too :/ ) | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
review_reward = ppl.review_rewards.find_by_name("Review Reward") || ppl.review_rewards.build(:name => "Review Reward") | |
review_reward.headline = "Free Nutritional Program DVD" | |
review_reward.details = "We recognize that feedback is what makes us better. As a thank your for giving us feedback on our services we would like to provide you with this free instructional program on nutrition. At a $50 value, this program outlines best practices, common myths, and quick food that keeps you on a healthy path. Just bring in this certificate to redeem your DVD today" | |
review_reward.start_date = today | |
review_reward.fine_print = "Only one DVD per person. May not be replaced for other DVDs or items. Certificate only valid for individual listed." | |
review_reward.default = true | |
review_reward.save! if review_reward.changed? | |
end | |
# Create an offer campaign | |
# ================================= | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
[ "20% Off Supplements", "Complimentary Consultation", "$50 Off Second Treatment" | |
].each do |offer_name| | |
offer = ppl.offers.find_by_name(offer_name) || ppl.offers.build(:name => offer_name) | |
offer.headline = offer_name | |
offer.details = Faker::Lorem.paragraph | |
offer.start_at = [35, 40, 55, 60].rand.days.ago | |
offer.fine_print = 'Offer cannot be combined with other offers. Offer may change at any time without notice. Does not include any applicable taxes. Appointments require 24 cancellation notice.' | |
offer.approved_at = offer.start_at | |
offer.created_at = offer.start_at | |
offer.save! if offer.changed? | |
end | |
offer = ppl.offers.find_by_name('Weekday Morning Promotion') || ppl.offers.build(:name => 'Weekday Morning Promotion') | |
offer.headline = '15% off - early bird discount' | |
offer.details = 'For a limited time only, appointments before 11am, Monday through Friday, will receive 15% off when this offer is presented. Call to make your appointment today.' | |
offer.start_at = 30.days.ago | |
offer.end_at = 365.days.from_now | |
offer.fine_print = 'Offer cannot be combined with other offers. Offer may change at any time without notice. Does not include any applicable taxes. Appointments require 24 cancellation notice.' | |
offer.approved_at = offer.start_at | |
offer.created_at = offer.start_at | |
offer.save! if offer.changed? | |
Image.create!(:file_name => open('public/images/tmp/molda-offer.png'), :entity => offer) if offer.image.blank? | |
# Promote the offer on facebook (not really sending it, just making sure we have a publishing history) | |
if ppl.default_facebook_page.present? && aaron.facebook_profile.present? | |
facebook_promotion = offer.facebook_promotions.create!(:message => offer.headline, :send_immediately => true) | |
facebook_promotion.facebook_promotion_pages.create!(:facebook_page => ppl.default_facebook_page) | |
facebook_promotion.facebook_promotion_profiles.create!(:facebook_profile => aaron.facebook_profile) | |
end | |
# Promote the offer on twitter (not really sending it, just making sure we have a publishing history) | |
twitter_promotion = offer.twitter_promotions.create!(:message => offer.headline, :send_immediately => true) | |
twitter_promotion.twitter_promotion_profiles.create!(:twitter_profile => ppl.default_twitter_profile) | |
end | |
# Create a news campaign | |
# ================================= | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
[ "New Office", "Carpel Tunnel Syndrome", "Corporate Care", "Corrective Care", | |
].each do |news_name| | |
news = ppl.news.find_by_name(news_name) || ppl.news.build(:name => news_name) | |
news.headline = news_name | |
news.details = Faker::Lorem.paragraph | |
news.start_at = [37, 42, 47, 52].rand.days.ago | |
news.end_at = [ nil, news.start_at + 30.days ].rand | |
news.approved_at = news.start_at | |
news.created_at = news.start_at | |
news.save! if news.changed? | |
end | |
news = ppl.news.find_by_name('TMJ Disorder') || ppl.news.build(:name => 'TMJ Disorder') | |
news.headline = 'TMJ Disorder - It Can Even Make Talking Painful' | |
news.details = IO.read('db/seeds/molda_tmj_disorder.txt') | |
news.start_at = 33.days.ago | |
news.end_at = today + 100 | |
news.approved_at = 33.days.ago | |
news.created_at = news.start_at | |
news.save! if news.changed? | |
Image.create!(:file_name => open('public/images/tmp/tmj-disorder.png'), :entity => news) if news.image.blank? | |
end | |
# Create a poll campaign | |
# ================================= | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
#[ "Services Question", "Seeking Care Poll", "Tell Us About Your Last Visit", "Sleep Survey", "Open House Follow Up" | |
#].each do |poll_name| | |
#poll = ppl.polls.find_by_name(poll_name) || Factory(:poll, :name => poll_name, :client => ppl) | |
#poll.start_at = [7, 12, 17, 22].rand.days.ago | |
#poll.end_at = [ nil, poll.start_at + 30.days ].rand | |
#poll.approved_at = poll.start_at | |
#poll.save! if poll.changed? | |
#end | |
poll = ppl.polls.find_by_name("Service Question") || ppl.polls.build(:name => "Service Question") | |
poll.start_at = 45.days.ago | |
poll.end_at = today + 100 | |
poll.approved_at = 40.days.ago | |
poll.save! if poll.changed? | |
question = "If we were to add services, which one would you be most interested in?" | |
if poll.poll_question.blank? | |
poll_question = PollQuestion::MultiChoice.new(:question => question, :poll => poll) | |
poll_question.poll_answers.build(:answer => "Nutritional Consulting") | |
poll_question.poll_answers.build(:answer => "Myofascial Release Therapy") | |
poll_question.poll_answers.build(:answer => "Acupuncture") | |
poll_question.poll_answers.build(:answer => "Yoga & Pilates Flexibility Training") | |
poll_question.save! | |
poll.poll_question = poll_question | |
end | |
poll.poll_question.question = question | |
poll.poll_question.save! if poll.poll_question.changed? | |
end | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
[ "Dr. M's Lecture", "We Moved!" | |
].each do |event_name| | |
event = ppl.events.find_by_name(event_name) || ppl.events.build(:name => event_name) | |
event.headline = event_name | |
event.details = Faker::Lorem.paragraph | |
event.start_at = [12, 16, 22, 26].rand.days.ago | |
event.end_at = [ nil, event.start_at + 30.days ].rand | |
event.approved_at = event.start_at | |
event.created_at = event.start_at | |
event.save! if event.changed? | |
end | |
event = ppl.events.find_by_name("First Fridays") || ppl.events.build(:name => "First Fridays") | |
event.headline = "First Fridays" | |
event.details = "We are starting a monthly health and wellness siminar on the first Friday of every month. Join us for our kickoff." | |
event.start_at = 10.days.ago | |
event.end_at = [ nil, (event.start_at + 30.days)].rand; | |
event.approved_at = event.start_at | |
event.created_at = event.start_at | |
event.save! if event.changed? | |
end | |
# Create some connections | |
# ================================= | |
aaron.as_current do | |
ppl = Business.find_by_display_name('Posture People') | |
User.transaction do | |
[ ConnectionType.customers, | |
ConnectionType.partners, | |
ConnectionType.family_and_friends, | |
ConnectionType.employees, | |
ConnectionType.uncategorized | |
].each do |connection_type| | |
3.times do | |
TestFixtures::PosturePeople.each_fake_connection_for(connection_type) do |test_user| | |
user = ppl.reseller.users.find_by_email(test_user.gmail_address) || ppl.reseller.users.new | |
user.email = test_user.gmail_address | |
user.password = user.password_confirmation = 'joinlocal' | |
user.display_name = test_user.display_name | |
user.save! | |
unless ppl.users.connections.include?(user) | |
connection = ppl.create_connection!(user, connection_type) | |
connection.create_connection_profile({ | |
:street1 => Faker::Address.street_address, | |
:city => Faker::Address.city, | |
:state => Faker::Address.us_state, | |
:postalcode => Faker::Address.zip_code, | |
:phone => Faker::PhoneNumber.phone_number | |
}) | |
connection.created_at = [1, 31, 61, 70].rand.days.ago | |
connection.save! if connection.changed? | |
# XXX demo-hack make it look like 75% of our connections got join rewards.. | |
[1,1,1,0].rand.times do | |
ppl.tracking_events.create!({ | |
:action => :joined, | |
:category => 'connection_event', | |
:channel => ppl.business_profile, | |
:created_by => user, | |
:created_by_visitor => Visitor.find_or_create!(user.email), | |
:prompted_by => nil, | |
:prompted_by_visitor => nil, | |
:subject => ppl.business_profile, | |
}) | |
end | |
if connection.demo_image_present? && ppl.default_facebook_page.present? | |
[0,1].rand.times do | |
connection.twitter_profile_followers.create!(:twitter_profile => ppl.twitter_profiles.first) | |
end | |
[0,1,1].rand.times do | |
connection.facebook_page_fans.create!(:facebook_page => ppl.default_facebook_page) | |
end | |
end | |
end | |
Visitor.find_or_create!(user.email).as_current do | |
# Generate email, facebook and twitter shares. | |
if test_user.percentile <= 60 | |
user.as_current do | |
event = [ ppl.events.last, ppl.events.order('random()').limit(1).first ].rand | |
news = [ ppl.news.last , ppl.news.order('random()').limit(1).first ].rand | |
offer = [ ppl.offers.last, ppl.offers.last, ppl.offers.order('random()').limit(1).first, ppl.offers.order('random()').limit(1).first, ppl.offers.order('random()').limit(1).first ].rand | |
poll = ppl.polls.order('random()').limit(1).first | |
# everyone in the 40th+ percentile has viewed w/in the last two weeks. | |
5.times do | |
Timecop.travel(Array( 2 .. 10 ).rand.days.ago) do | |
campaign = [news, offer, offer, offer, poll, offer, poll, event].rand # favor the offer | |
campaign.track!(:viewed, :channel => ppl.business_profile, :prompted_by => campaign.updated_by) | |
case campaign | |
when Offer | |
[0,0,1,1,1].rand.times { Factory(:printed_share, :shareable => campaign, :business => ppl).printed! } | |
campaign.track!(:viewed, :channel => ppl.business_profile, :prompted_by => campaign.updated_by) | |
#when Poll | |
## one in four will answer the poll | |
#[0,0,1,1].rand.times { campaign.track!(:answered, :channel => ppl.business_profile, :prompted_by => campaign.updated_by) } | |
#campaign.track!(:viewed, :channel => ppl.business_profile, :prompted_by => campaign.updated_by) | |
end | |
end | |
end | |
# everyone in the 70th+ percentile has shared w/in ... | |
2.times do | |
if test_user.percentile <= 20 | |
Timecop.travel(Array( 4 .. 8 ).rand.days.ago) do | |
shareable = [offer, offer, news, event].rand | |
share = Factory([:email_share_with_recipients, :facebook_share, :twitter_share].rand, :shareable => shareable, :business => ppl) | |
share.shared! | |
shareable.track!(:viewed, :channel => ppl.business_profile, :prompted_by => shareable.updated_by) | |
end | |
end | |
end | |
# everyone in the 90th+ percentile has shared w/in ... with accellerated viewing | |
if test_user.percentile <= 8 | |
Timecop.travel(Array( 5 .. 6 ).rand.days.ago) do | |
shareable = [offer, offer, news, poll, event].rand | |
share = Factory([:email_share_with_recipients, :facebook_share, :twitter_share].rand, :shareable => shareable, :business => ppl) | |
share.shared! | |
case share | |
when EmailShare | |
share.email_share_recipients.first.referred! | |
else | |
share.referred! | |
end | |
Array(2..5).rand.times { shareable.track!(:viewed, :channel => ppl.business_profile, :prompted_by => shareable.updated_by) } | |
end | |
end | |
if test_user.percentile <= 4 | |
Timecop.travel(Array( 4 .. 7 ).rand.days.ago) do | |
shareable = [offer, offer, news, event].rand | |
share = Factory([:email_share_with_recipients, :facebook_share, :twitter_share].rand, :shareable => shareable, :business => ppl) | |
share.shared! | |
Array(2..4).rand.times { shareable.track!(:viewed, :channel => ppl.business_profile, :prompted_by => shareable.updated_by) } | |
poll.track!(:viewed, :channel => ppl.business_profile, :prompted_by => shareable.updated_by) | |
#Array(2..3).rand.times { poll.track!(:answered, :channel => ppl.business_profile, :prompted_by => poll.updated_by) } | |
#poll.track!(:viewed, :channel => ppl.business_profile, :prompted_by => shareable.updated_by) | |
end | |
end | |
end | |
end | |
end | |
unless user.tracking_events.empty? | |
user.update_attributes!(:created_at => user.tracking_events.order(:created_at).first.created_at) | |
end | |
end | |
end | |
end # transaction | |
end | |
end | |
Business.find_by_display_name('Posture People').tap do |ppl| | |
ppl.influencers.each do |influencer| | |
influencer.update_attributes!(:created_at => [35,40,45,50,60,90].rand.days.ago) | |
end | |
end | |
# Create reviews | |
# ================================= | |
ppl = Business.find_by_display_name('Posture People') | |
user = reseller.users.find_by_email('[email protected]') || reseller.users.new | |
user.display_name = 'Jeanie R.' | |
user.email = '[email protected]' | |
user.password = user.password_confirmation = 'joinlocal' | |
user.save! if user.changed? | |
user.as_current do | |
ppl.users.connections.include?(user) || ppl.create_connection!(user, ConnectionType::Customers) | |
review = ppl.reviews.find_by_created_by_id(user) || ppl.reviews.build | |
review.connection = ppl.connections.find_by_user_id(user.id) | |
review.title = "Computer Fatigue" | |
review.content = "I work on my computer several hours a day. My neck and shoulders started to feel achy and tight. Over several months, the aches turned into moderate and sometimes severe pain. I was taking 800 mg of Motrin every 4-6 h#ours almost every day. the ice packs and hot packs provided me with only temporary relief. I've been a patient of Dr. Molda's now for 4 months and haven't needed to Motrin at all. The range of motion in my neck has greatly improved ( I am# able to easily turn my head around in the car to see what is behind me) and due to his ""spinal adjustments"", my pain has nearly diminished." | |
review.status = 'published' | |
review.save if review.changed? | |
review.publish! | |
end | |
user = reseller.users.find_by_email('[email protected]') || reseller.users.new | |
user.display_name = 'Eunice McFranklebergson' | |
user.email = '[email protected]' | |
user.password = user.password_confirmation = 'joinlocal' | |
user.save! if user.changed? | |
user.as_current do | |
ppl.users.connections.include?(user) || ppl.create_connection!(user, ConnectionType::Customers) | |
review = ppl.reviews.find_by_created_by_id(user) || ppl.reviews.build | |
review.connection = ppl.connections.find_by_user_id(user.id) | |
review.title = "Hip and Leg Pain" | |
review.content = "For 5 years, my leg and hip pain prevented me from walking normally. I used a cane to walk and could no longer walk up and down stairs without leaning on a railing. I am now able to walk almost normally up and down st#airs. I can do exercises with more ease, my shoulder tendonitis is less of a problem and I get fewer headaches." | |
review.status = 'published' | |
review.save! if review.changed? | |
review.publish! | |
end | |
# Pending Reviews | |
# ----------------- | |
Business.find_by_display_name('Posture People').tap do |ppl| | |
# TODO this is leaving rewards behind that have a reference!!! | |
ppl.reviews.destroy_all | |
reviewer_ids = [0] | |
# Pending Reviews | |
# --------------- | |
pending_reviews = [ | |
{ :created_at => 2.days.ago , :title => "", :content => "I went to Posture People from a referral from my personal injury attorney after being rear ended in a auto accident. I was having severe neck pain and thought from the headaches, my head was going to explode. I went to see this chiropractor and he work with me on a lien basis and with my attorney. Put me through a series ...", }, | |
{ :created_at => 1.month.ago , :title => "Lower Back Pain", :content => "I was having low back pain & numbness in my feet. I tried foot orthotics to physical therapy to a couple of other doctors in Maine area, and got no improvement. I about had it with my symptoms because they were just getting ...", }, | |
{ :created_at => 2.months.ago, :title => "Headaches", :content => "Dr. Molda is an amazing Chiropractor. I started seeing him last year for headaches. I could hardly get out of bed when I started seeing him. With in two weeks of chiropractor adjustments (4 visits), I could function and my headaches were almost gone. Today I am 6 months pregnant, I don't have headaches and if I ever come in with a weird ...", }, | |
] | |
ppl.connections.order('random()').limit(3).where('client_users.id not in (%s)' % reviewer_ids.join(',')).each_with_index do |connection, index| | |
review = connection.reviews.build(pending_reviews[index]) | |
review.allow_publish = true | |
review.rating = [4, 5].rand | |
review.client = ppl # TODO I don't think this relation is needed/wanted. | |
review.reward = ppl.review_rewards.first if [true, false].rand | |
connection.user.as_current { review.save! } if review.changed? | |
reviewer_ids << connection.id | |
end | |
# Published Reviews | |
# ----------------- | |
published_reviews = [ | |
{ :created_at => 1.month.ago , :title => "Neck Pain" , :content => "I have had severe back pain & neck pain for several months that started after running in a Marathon. I went to a physical therapy got some relief but all they made me do was exercises and stretches. I was told to strengthen my core, and we tried that for 8 months there with little relief. Then I was referred to Dr. M and he educated" }, | |
{ :created_at => 4.months.ago, :title => "" , :content => "Dr Molda was great!" }, | |
{ :created_at => 3.months.ago, :title => "Bike Accident" , :content => "I was in a minor bicycling accident last September. Although I did not realize it at the time, my pelvis became misaligned and insidiously strained the muscles and bones in my left hip. In December of 1999, I became unable to perform my duties as a registered nurse because of the constant pain" }, | |
{ :created_at => 6.months.ago, :title => "Old FootBall Injury", :content => "Dr. M fixed my old football injury, now I'm able to do yard back pain free!" }, | |
] | |
ppl.connections.order('random()').limit(3).where('client_users.id not in (%s)' % reviewer_ids.join(',')).each_with_index do |connection, index| | |
review = connection.reviews.build(pending_reviews[index]) | |
review.allow_publish = true | |
review.rating = [4, 5].rand | |
review.client = ppl # TODO I don't think this relation is needed/wanted. | |
review.reward = ppl.review_rewards.first if [true, false].rand | |
connection.user.as_current { review.save! } if review.changed? | |
review.publish! | |
reviewer_ids << connection.id | |
end | |
# Archived Reviews | |
# ---------------- | |
published_reviews = [ | |
{ :created_at => 2.days.ago , :title => "CHIROPRACTOR FOR NECK PAIN!", :content => "I am writing this review about this great chiropractor in the Main area because this clinic is simply the best. This chiropractic office not only believes in making my neck pain go away but additionally fixed the cause of my problem. I was amazed by the customer service I received there and how detail..." }, | |
{ :created_at => 2.months.ago, :title => "", :content => "Dr. Molda really fixed my back after my car accedent. He's great!" }, | |
{ :created_at => 1.month.ago, :title => "You are the BEST", :content => "Lee and I want to thank you so much for all the care you've given us -- fixing Lee's shoulder and my neck! You are the BEST and we want you to know it! You've even put up with Lee's craziness!" }, | |
{ :created_at => 3.months.ago, :title => "I no longer experience the constant neck pain", :content => "I no longer experience the constant neck pain that I was suffering from. The work you have done for my forward head posture is great. Thank you." }, | |
] | |
ppl.connections.order('random()').limit(3).where('client_users.id not in (%s)' % reviewer_ids.join(',')).each_with_index do |connection, index| | |
review = connection.reviews.build(pending_reviews[index]) | |
review.allow_publish = true | |
review.rating = [4, 5].rand | |
review.client = ppl # TODO I don't think this relation is needed/wanted. | |
review.reward = ppl.review_rewards.first if [true, false].rand | |
connection.user.as_current { review.save! } if review.changed? | |
review.archive! | |
reviewer_ids << connection.id | |
end | |
end | |
Offer.find_by_name("20% Off Supplements").update_attribute(:details, "Bring this offer in to get 20% off your purchase of supplements including our lines of vitamins, meal replacements, and homeopathic treatments. All of our supplements are the highest grade and are backed by our 30 day guarantee. Stop by today.") | |
Offer.find_by_name("Complimentary Consultation").update_attribute(:details, "First time customers, bring this offer in for posture, nutrition, and fitness consultation normally valued at $50. There is no additional commitment required. Please call to make an appointment.") | |
Offer.find_by_name("$50 Off Second Treatment").update_attribute(:details, "Bring this offer in for $50 off your second treatment of a specific service at Posture People. Offer only available once per customer. Please call for details and to make an appointment.") | |
Event.find_by_name("Dr. M's Lecture").update_attribute(:start_at, Chronic.parse('4-20-11')) | |
Event.find_by_name("Dr. M's Lecture").update_attribute(:details, "Join Dr. Molda for a lecture at York Community College on wellness, chiropractic philosophy, the mind/body connection. The lecture is open to the public and free of charge. Please RSVP to reserve your spot as space is limited.") | |
Event.find_by_name("We Moved!").update_attribute(:start_at, Chronic.parse('3-4-11')) | |
Event.find_by_name("We Moved!").update_attribute(:details, "Help us celebrate our move with an office-warming party. We'll have an open house style party on Saturday from 11-4pm. There will be gifts for adults and kids as well as snacks. Thank you for your continued support of Posture People.") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment