Implement Event Ratings
This commit is contained in:
parent
5be1ad52ee
commit
20f4853487
67 changed files with 1298 additions and 378 deletions
17
db/migrate/20160922205550_create_rating_caches.rb
Normal file
17
db/migrate/20160922205550_create_rating_caches.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class CreateRatingCaches < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :rating_caches do |t|
|
||||
t.belongs_to :cacheable, polymorphic: true
|
||||
t.float :avg, null: false
|
||||
t.integer :qty, null: false
|
||||
t.string :dimension
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :rating_caches, [:cacheable_id, :cacheable_type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :rating_caches
|
||||
end
|
||||
end
|
||||
18
db/migrate/20160922205551_create_rates.rb
Normal file
18
db/migrate/20160922205551_create_rates.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class CreateRates < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :rates do |t|
|
||||
t.belongs_to :rater
|
||||
t.belongs_to :rateable, polymorphic: true
|
||||
t.float :stars, null: false
|
||||
t.string :dimension
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :rates, :rater_id
|
||||
add_index :rates, [:rateable_id, :rateable_type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :rates
|
||||
end
|
||||
end
|
||||
14
db/migrate/20160922205552_create_average_caches.rb
Normal file
14
db/migrate/20160922205552_create_average_caches.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class CreateAverageCaches < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :average_caches do |t|
|
||||
t.belongs_to :rater
|
||||
t.belongs_to :rateable, polymorphic: true
|
||||
t.float :avg, null: false
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :average_caches
|
||||
end
|
||||
end
|
||||
13
db/migrate/20160922205553_create_overall_averages.rb
Normal file
13
db/migrate/20160922205553_create_overall_averages.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class CreateOverallAverages < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :overall_averages do |t|
|
||||
t.belongs_to :rateable, polymorphic: true
|
||||
t.float :overall_avg, null: false
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :overall_averages
|
||||
end
|
||||
end
|
||||
12
db/migrate/20170319144754_create_votable_fields.rb
Normal file
12
db/migrate/20170319144754_create_votable_fields.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class CreateVotableFields < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :votable_fields do |t|
|
||||
t.string :title
|
||||
t.string :votable_type
|
||||
t.boolean :enabled, default: true
|
||||
t.references :conference
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddForAdminToVotableField < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :votable_fields, :for_admin, :boolean, default: false
|
||||
end
|
||||
end
|
||||
5
db/migrate/20170326084800_add_stars_to_votable_field.rb
Normal file
5
db/migrate/20170326084800_add_stars_to_votable_field.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddStarsToVotableField < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :votable_fields, :stars, :integer, default: 5
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddRatingEnabledToProgram < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :programs, :rating_enabled, :boolean, default: false
|
||||
end
|
||||
end
|
||||
56
db/schema.rb
56
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170302145716) do
|
||||
ActiveRecord::Schema.define(version: 20170405004359) do
|
||||
|
||||
create_table "ahoy_events", force: :cascade do |t|
|
||||
t.uuid "visit_id", limit: 16
|
||||
|
|
@ -31,6 +31,15 @@ ActiveRecord::Schema.define(version: 20170302145716) do
|
|||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "average_caches", force: :cascade do |t|
|
||||
t.integer "rater_id"
|
||||
t.integer "rateable_id"
|
||||
t.string "rateable_type"
|
||||
t.float "avg", null: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "campaigns", force: :cascade do |t|
|
||||
t.integer "conference_id"
|
||||
t.string "name"
|
||||
|
|
@ -266,6 +275,14 @@ ActiveRecord::Schema.define(version: 20170302145716) do
|
|||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "overall_averages", force: :cascade do |t|
|
||||
t.integer "rateable_id"
|
||||
t.string "rateable_type"
|
||||
t.float "overall_avg", null: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "payments", force: :cascade do |t|
|
||||
t.string "last4"
|
||||
t.integer "amount"
|
||||
|
|
@ -290,6 +307,7 @@ ActiveRecord::Schema.define(version: 20170302145716) do
|
|||
t.datetime "voting_end_date"
|
||||
t.integer "selected_schedule_id"
|
||||
t.integer "schedule_interval", default: 15, null: false
|
||||
t.boolean "rating_enabled", default: false
|
||||
end
|
||||
|
||||
add_index "programs", ["selected_schedule_id"], name: "index_programs_on_selected_schedule_id"
|
||||
|
|
@ -321,6 +339,31 @@ ActiveRecord::Schema.define(version: 20170302145716) do
|
|||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "rates", force: :cascade do |t|
|
||||
t.integer "rater_id"
|
||||
t.integer "rateable_id"
|
||||
t.string "rateable_type"
|
||||
t.float "stars", null: false
|
||||
t.string "dimension"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "rates", ["rateable_id", "rateable_type"], name: "index_rates_on_rateable_id_and_rateable_type"
|
||||
add_index "rates", ["rater_id"], name: "index_rates_on_rater_id"
|
||||
|
||||
create_table "rating_caches", force: :cascade do |t|
|
||||
t.integer "cacheable_id"
|
||||
t.string "cacheable_type"
|
||||
t.float "avg", null: false
|
||||
t.integer "qty", null: false
|
||||
t.string "dimension"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "rating_caches", ["cacheable_id", "cacheable_type"], name: "index_rating_caches_on_cacheable_id_and_cacheable_type"
|
||||
|
||||
create_table "registration_periods", force: :cascade do |t|
|
||||
t.integer "conference_id"
|
||||
t.date "start_date"
|
||||
|
|
@ -583,6 +626,17 @@ ActiveRecord::Schema.define(version: 20170302145716) do
|
|||
|
||||
add_index "visits", ["user_id"], name: "index_visits_on_user_id"
|
||||
|
||||
create_table "votable_fields", force: :cascade do |t|
|
||||
t.string "title"
|
||||
t.string "votable_type"
|
||||
t.boolean "enabled", default: true
|
||||
t.integer "conference_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "for_admin", default: false
|
||||
t.integer "stars", default: 5
|
||||
end
|
||||
|
||||
create_table "votes", force: :cascade do |t|
|
||||
t.integer "event_id"
|
||||
t.integer "rating"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue