老师布置编程作业界面增加测试,以及测试结果的存储

This commit is contained in:
sw 2015-07-30 17:38:01 +08:00
parent 28509b7cdd
commit 5e885d9417
4 changed files with 16 additions and 13 deletions

View File

@ -97,6 +97,7 @@
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a> <a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a> <a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
<a class="green_btn fl ml5 mt1">测试</a> <a class="green_btn fl ml5 mt1">测试</a>
<input type="hidden" class="fl h26 w190 mb10" id="test_result_<%= homework_test.id%>" name="result[<%= homework_test.id%>]" />
</li> </li>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
@ -115,6 +116,7 @@
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a> <a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a> <a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
<a class="green_btn fl ml5 mt1">测试</a> <a class="green_btn fl ml5 mt1">测试</a>
<input type="hidden" class="fl h26 w190 mb10" id="test_result_0" name="result[0]" />
</li> </li>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -0,0 +1,9 @@
class AddResultToTest < ActiveRecord::Migration
def up
add_column :homework_tests, :result, :integer,default: 0
end
def down
remove_column :homework_tests,:result
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150722015428) do ActiveRecord::Schema.define(:version => 20150730093403) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -634,6 +634,7 @@ ActiveRecord::Schema.define(:version => 20150722015428) do
t.integer "homework_common_id" t.integer "homework_common_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "result", :default => 0
end end
create_table "homework_users", :force => true do |t| create_table "homework_users", :force => true do |t|
@ -744,16 +745,6 @@ ActiveRecord::Schema.define(:version => 20150722015428) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t| create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id" t.integer "journal_id"
t.integer "user_id" t.integer "user_id"

View File

@ -551,6 +551,7 @@ function add_programing_test(obj) {
"</li><li><a class='icon_add ml10' href='javascript:void(0);' title='添加测试' onclick='add_programing_test($(this).parent().parent())'></a>" + "</li><li><a class='icon_add ml10' href='javascript:void(0);' title='添加测试' onclick='add_programing_test($(this).parent().parent())'></a>" +
"<a class='icon_remove' href='javascript:void(0);' title='删除测试' onclick='remove_programing_test($(this).parent().parent())'></a>" + "<a class='icon_remove' href='javascript:void(0);' title='删除测试' onclick='remove_programing_test($(this).parent().parent())'></a>" +
"<a class='green_btn fl ml5 mt1'>测试</a>" + "<a class='green_btn fl ml5 mt1'>测试</a>" +
"<input type='hidden' id='test_result_" + now +"' name='result[" + now +"]' />" +
"</li><div class='cl'></div></div>"); "</li><div class='cl'></div></div>");
} }
//删除测试结果 //删除测试结果