removed expected working time from show/create/index and database since we do not use it

This commit is contained in:
Thomas Hille
2017-10-03 18:46:39 +02:00
parent 2806d9bf85
commit 95a849e9f5
8 changed files with 49 additions and 17 deletions

View File

@ -143,8 +143,7 @@ class ExercisesController < ApplicationController
private :user_by_code_harbor_token private :user_by_code_harbor_token
def exercise_params def exercise_params
params[:exercise][:expected_worktime_seconds] = params[:exercise][:expected_worktime_minutes].to_i * 60 params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :allow_file_creation, :allow_auto_completion, :title, :expected_difficulty, files_attributes: file_attributes, :tag_ids => []).merge(user_id: current_user.id, user_type: current_user.class.name)
params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :allow_file_creation, :allow_auto_completion, :title, :expected_difficulty, :expected_worktime_seconds, files_attributes: file_attributes, :tag_ids => []).merge(user_id: current_user.id, user_type: current_user.class.name)
end end
private :exercise_params private :exercise_params

View File

@ -35,9 +35,6 @@
.form-group .form-group
= f.label(t('activerecord.attributes.exercise.difficulty')) = f.label(t('activerecord.attributes.exercise.difficulty'))
= f.number_field :expected_difficulty, in: 1..10, step: 1 = f.number_field :expected_difficulty, in: 1..10, step: 1
.form-group
= f.label(t('activerecord.attributes.exercise.worktime'))
= f.number_field "expected_worktime_minutes", value: @exercise.expected_worktime_seconds / 60, in: 1..1000, step: 1
h2 = t('exercises.form.tags') h2 = t('exercises.form.tags')
ul.list-unstyled.panel-group ul.list-unstyled.panel-group

View File

@ -18,7 +18,6 @@ h1 = Exercise.model_name.human(count: 2)
th = t('activerecord.attributes.exercise.maximum_score') th = t('activerecord.attributes.exercise.maximum_score')
th = t('activerecord.attributes.exercise.tags') th = t('activerecord.attributes.exercise.tags')
th = t('activerecord.attributes.exercise.difficulty') th = t('activerecord.attributes.exercise.difficulty')
th = t('activerecord.attributes.exercise.worktime')
th th
= t('activerecord.attributes.exercise.public') = t('activerecord.attributes.exercise.public')
- if policy(Exercise).batch_update? - if policy(Exercise).batch_update?
@ -34,7 +33,6 @@ h1 = Exercise.model_name.human(count: 2)
td = exercise.maximum_score td = exercise.maximum_score
td = exercise.exercise_tags.count td = exercise.exercise_tags.count
td = exercise.expected_difficulty td = exercise.expected_difficulty
td = (exercise.expected_worktime_seconds / 60).ceil
td.public data-value=exercise.public? = symbol_for(exercise.public?) td.public data-value=exercise.public? = symbol_for(exercise.public?)
td = link_to(t('shared.edit'), edit_exercise_path(exercise)) if policy(exercise).edit? td = link_to(t('shared.edit'), edit_exercise_path(exercise)) if policy(exercise).edit?
td = link_to(t('.implement'), implement_exercise_path(exercise)) if policy(exercise).implement? td = link_to(t('.implement'), implement_exercise_path(exercise)) if policy(exercise).implement?

View File

@ -20,7 +20,6 @@ h1
= row(label: 'exercise.embedding_parameters') do = row(label: 'exercise.embedding_parameters') do
= content_tag(:input, nil, class: 'form-control', readonly: true, value: embedding_parameters(@exercise)) = content_tag(:input, nil, class: 'form-control', readonly: true, value: embedding_parameters(@exercise))
= row(label: 'exercise.difficulty', value: @exercise.expected_difficulty) = row(label: 'exercise.difficulty', value: @exercise.expected_difficulty)
= row(label: 'exercise.worktime', value: "#{@exercise.expected_worktime_seconds/60} min")
= row(label: 'exercise.tags', value: @exercise.exercise_tags.map{|et| "#{et.tag.name} (#{et.factor})"}.sort.join(", ")) = row(label: 'exercise.tags', value: @exercise.exercise_tags.map{|et| "#{et.tag.name} (#{et.factor})"}.sort.join(", "))
h2 = t('activerecord.attributes.exercise.files') h2 = t('activerecord.attributes.exercise.files')

View File

@ -41,7 +41,6 @@ de:
allow_auto_completion: "Autovervollständigung aktivieren" allow_auto_completion: "Autovervollständigung aktivieren"
allow_file_creation: "Dateierstellung erlauben" allow_file_creation: "Dateierstellung erlauben"
difficulty: Schwierigkeitsgrad difficulty: Schwierigkeitsgrad
worktime: "vermutete Arbeitszeit in Minuten"
token: "Aufgaben-Token" token: "Aufgaben-Token"
proxy_exercise: proxy_exercise:
title: Title title: Title

View File

@ -41,7 +41,6 @@ en:
allow_auto_completion: "Allow auto completion" allow_auto_completion: "Allow auto completion"
allow_file_creation: "Allow file creation" allow_file_creation: "Allow file creation"
difficulty: Difficulty difficulty: Difficulty
worktime: "Expected worktime in minutes"
token: "Exercise Token" token: "Exercise Token"
proxy_exercise: proxy_exercise:
title: Title title: Title

View File

@ -0,0 +1,5 @@
class RemoveExpectedWorkingTime < ActiveRecord::Migration
def change
remove_column :exercises, :expected_worktime_seconds
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170920145852) do ActiveRecord::Schema.define(version: 20171002131135) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -47,6 +47,13 @@ ActiveRecord::Schema.define(version: 20170920145852) do
t.string "oauth_secret", limit: 255 t.string "oauth_secret", limit: 255
end end
create_table "copy_paste_events", id: false, force: :cascade do |t|
t.integer "exercise_id"
t.string "text"
t.integer "user_id"
t.datetime "created_at"
end
create_table "errors", force: :cascade do |t| create_table "errors", force: :cascade do |t|
t.integer "execution_environment_id" t.integer "execution_environment_id"
t.text "message" t.text "message"
@ -99,19 +106,18 @@ ActiveRecord::Schema.define(version: 20170920145852) do
create_table "exercises", force: :cascade do |t| create_table "exercises", force: :cascade do |t|
t.text "description" t.text "description"
t.integer "execution_environment_id" t.integer "execution_environment_id"
t.string "title", limit: 255 t.string "title", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "user_id" t.integer "user_id"
t.text "instructions" t.text "instructions"
t.boolean "public" t.boolean "public"
t.string "user_type", limit: 255 t.string "user_type", limit: 255
t.string "token", limit: 255 t.string "token", limit: 255
t.boolean "hide_file_tree" t.boolean "hide_file_tree"
t.boolean "allow_file_creation" t.boolean "allow_file_creation"
t.boolean "allow_auto_completion", default: false t.boolean "allow_auto_completion", default: false
t.integer "expected_worktime_seconds", default: 60 t.integer "expected_difficulty", default: 1
t.integer "expected_difficulty", default: 1
end end
create_table "exercises_proxy_exercises", id: false, force: :cascade do |t| create_table "exercises_proxy_exercises", id: false, force: :cascade do |t|
@ -124,6 +130,11 @@ ActiveRecord::Schema.define(version: 20170920145852) do
add_index "exercises_proxy_exercises", ["exercise_id"], name: "index_exercises_proxy_exercises_on_exercise_id", using: :btree add_index "exercises_proxy_exercises", ["exercise_id"], name: "index_exercises_proxy_exercises_on_exercise_id", using: :btree
add_index "exercises_proxy_exercises", ["proxy_exercise_id"], name: "index_exercises_proxy_exercises_on_proxy_exercise_id", using: :btree add_index "exercises_proxy_exercises", ["proxy_exercise_id"], name: "index_exercises_proxy_exercises_on_proxy_exercise_id", using: :btree
create_table "external_user_skill_level", id: false, force: :cascade do |t|
t.string "external_user_id"
t.integer "skill_level"
end
create_table "external_users", force: :cascade do |t| create_table "external_users", force: :cascade do |t|
t.integer "consumer_id" t.integer "consumer_id"
t.string "email", limit: 255 t.string "email", limit: 255
@ -342,4 +353,29 @@ ActiveRecord::Schema.define(version: 20170920145852) do
add_index "user_proxy_exercise_exercises", ["proxy_exercise_id"], name: "index_user_proxy_exercise_exercises_on_proxy_exercise_id", using: :btree add_index "user_proxy_exercise_exercises", ["proxy_exercise_id"], name: "index_user_proxy_exercise_exercises_on_proxy_exercise_id", using: :btree
add_index "user_proxy_exercise_exercises", ["user_type", "user_id"], name: "index_user_proxy_exercise_exercises_on_user_type_and_user_id", using: :btree add_index "user_proxy_exercise_exercises", ["user_type", "user_id"], name: "index_user_proxy_exercise_exercises_on_user_type_and_user_id", using: :btree
create_table "user_proxy_exercise_exercises_copy", id: false, force: :cascade do |t|
t.integer "id"
t.integer "user_id"
t.string "user_type"
t.integer "proxy_exercise_id"
t.integer "exercise_id"
t.datetime "created_at"
t.datetime "updated_at"
t.json "reason"
t.json "reason_json"
end
create_table "wk_with_wk_until_rfc", id: false, force: :cascade do |t|
t.string "external_user_id", limit: 255
t.integer "user_id"
t.integer "exercise_id"
t.float "max_score"
t.float "max_reachable_points"
t.string "working_time"
t.string "working_time_until_rfc"
t.string "working_time_until_rfc_reply"
t.time "percentile75"
t.time "percentile90"
end
end end