Extended Exercises by worktime, difficulty and tags, added ProxyExercises as prework for recommendations

Tags can be added to exercises in the edit view. Tags can monitored under /tags.
Added the concept of ProxyExercises which are a collection of Exercises. They can be found under /proxy_exercises
Added Interventions as prework to show interventions later to the user.
Added exercise/[:id]/working_time to return the working time of the user in this exercise and the average working time of all users in this exercise
This commit is contained in:
Thomas Hille
2017-01-29 20:26:45 +01:00
parent 8f927d5ac9
commit 0db11884bc
40 changed files with 675 additions and 5 deletions

View File

@ -0,0 +1,14 @@
class CreateExerciseCollections < ActiveRecord::Migration
def change
create_table :exercise_collections do |t|
t.string :name
t.timestamps
end
create_table :exercise_collections_exercises, id: false do |t|
t.belongs_to :exercise_collection, index: true
t.belongs_to :exercise, index: true
end
end
end

View File

@ -0,0 +1,23 @@
class CreateProxyExercises < ActiveRecord::Migration
def change
create_table :proxy_exercises do |t|
t.string :title
t.string :description
t.string :token
t.timestamps
end
create_table :exercises_proxy_exercises, id: false do |t|
t.belongs_to :proxy_exercise, index: true
t.belongs_to :exercise, index: true
t.timestamps
end
create_table :user_proxy_exercise_exercises do |t|
t.belongs_to :user, polymorphic: true, index: true
t.belongs_to :proxy_exercise, index: true
t.belongs_to :exercise, index: true
t.timestamps
end
end
end

View File

@ -0,0 +1,16 @@
class CreateInterventions < ActiveRecord::Migration
def change
create_table :user_exercise_interventions do |t|
t.belongs_to :user, polymorphic: true
t.belongs_to :exercise
t.belongs_to :intervention
t.timestamps
end
create_table :interventions do |t|
t.string :name
t.text :markup
t.timestamps
end
end
end

View File

@ -0,0 +1,19 @@
class AddTags < ActiveRecord::Migration
def change
add_column :exercises, :expected_worktime_seconds, :integer, default: 0
add_column :exercises, :expected_difficulty, :integer, default: 1
create_table :tags do |t|
t.string :name, null: false
t.timestamps
end
create_table :exercise_tags do |t|
t.belongs_to :exercise
t.belongs_to :tag
t.integer :factor, default: 0
end
end
end

View File

@ -0,0 +1,11 @@
class AddUserFeedback < ActiveRecord::Migration
def change
create_table :user_exercise_feedbacks do |t|
t.belongs_to :exercise, null: false
t.belongs_to :user, polymorphic: true, null: false
t.integer :difficulty
t.integer :working_time_seconds
t.string :feedback_text
end
end
end