Skip to content

Commit

Permalink
task modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Abraham committed Jul 4, 2012
1 parent ee6fd2e commit 4457419
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/tasks/sample_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,27 @@ namespace :db do
#Create random Tender and populate the db
40.times do |n|
title = "#{Faker::Company.bs()} tender "
company_name = Faker::Company.name
buyer_name = Faker::Company.name
opening_date=Time.at(rand * Time.now.to_i)
closing_date=Time.at(opening_date + ( 8*7*24*60*60)) #add 8 weeks to the deadline
bid_amount= rand(10000...100000)
description=Faker::Lorem.paragraph(sentence_count = 3)

if n%3==0
status="Closed"
else if n%3==1
status="Intiated"
else status= "Won"
end


tender=Tender.new(title: title,
company_name: company_name,
buyer_name: buyer_name,
opening_date: opening_date,
closing_date: closing_date,
bid_amount: bid_amount ,
bid_amount: bid_amount ,
status: status,
description: description )

# Just to add the 10 companies' to different tenders
Expand Down
8 changes: 8 additions & 0 deletions lib/tasks/sample_data.rake~
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ namespace :db do
closing_date=Time.at(opening_date + ( 8*7*24*60*60)) #add 8 weeks to the deadline
bid_amount= rand(10000...100000)
description=Faker::Lorem.paragraph(sentence_count = 3)

if n%3==0
status="Closed"
else if n%3==1
status="Intiated"
else status= "Won"
end


tender=Tender.new(title: title,
Expand All @@ -83,6 +90,7 @@ namespace :db do
bid_amount: bid_amount ,
description: description )

# Just to add the 10 companies' to different tenders
tender.company_id=Company.find((n/4)+1).id
tender.save
end
Expand Down

0 comments on commit 4457419

Please sign in to comment.