Adds budget_lines.selected

This commit is contained in:
kikito
2016-12-22 20:24:59 +01:00
parent 688f52bb62
commit 430507ec1e
6 changed files with 28 additions and 7 deletions

View File

@@ -362,7 +362,7 @@ tags = Faker::Lorem.words(10)
external_url: Faker::Internet.url,
description: "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>",
created_at: rand((Time.now - 1.week) .. Time.now),
feasibility: %w{undecided feasible unfeasible}.sample,
feasibility: %w{undecided unfeasible feasible feasible feasible feasible}.sample,
unfeasibility_explanation: "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>",
valuation_finished: [false, true].sample,
tag_list: tags.sample(3).join(','),
@@ -371,6 +371,11 @@ tags = Faker::Lorem.words(10)
puts " #{investment.title}"
end
puts "Selecting Investments"
Budget.balloting.reorder("RANDOM()").limit(3).each do |budget|
budget.investments.feasible.reorder("RANDOM()").limit(10).update_all(selected: true)
end
puts "Creating Valuation Assignments"
(1..17).to_a.sample.times do

View File

@@ -0,0 +1,5 @@
class AddSelectedToBudgetInvestment < ActiveRecord::Migration
def change
add_column :budget_investments, :selected, :bool, default: false, index: true
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161102133838) do
ActiveRecord::Schema.define(version: 20161221172447) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -141,6 +141,7 @@ ActiveRecord::Schema.define(version: 20161102133838) do
t.string "responsible_name"
t.integer "budget_id"
t.integer "group_id"
t.boolean "selected", default: false
end
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree