From 0fa16251e759c8aadc7f4fb88ffb36f6016ca440 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Apr 2016 15:57:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84=E5=A4=9A=E5=88=86=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20160418074429_delete_other_works.rb | 11 +++++ db/schema.rb | 48 +++++++++++++++++-- 2 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20160418074429_delete_other_works.rb diff --git a/db/migrate/20160418074429_delete_other_works.rb b/db/migrate/20160418074429_delete_other_works.rb new file mode 100644 index 000000000..54944a6ec --- /dev/null +++ b/db/migrate/20160418074429_delete_other_works.rb @@ -0,0 +1,11 @@ +class DeleteOtherWorks < ActiveRecord::Migration + def up + works = StudentWork.where("homework_common_id = 3253 and user_id = 10740 and final_score = 0") + unless works.empty? + works.destroy_all + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 4e4201050..124870b49 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,11 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -<<<<<<< HEAD -ActiveRecord::Schema.define(:version => 20160331063938) do -======= -ActiveRecord::Schema.define(:version => 20160405021915) do ->>>>>>> c3ee4dadfb92c75e8649cad7e0ed57c2ec02ec00 +ActiveRecord::Schema.define(:version => 20160418074429) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -813,6 +809,7 @@ ActiveRecord::Schema.define(:version => 20160405021915) do t.integer "anonymous_comment", :default => 0 t.integer "quotes", :default => 0 t.integer "is_open", :default => 0 + t.datetime "simi_time" end add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" @@ -1524,6 +1521,18 @@ ActiveRecord::Schema.define(:version => 20160405021915) do t.string "topic_resource" end + create_table "rep_statics", :force => true do |t| + t.integer "project_id" + t.integer "commits_num" + t.string "uname" + t.string "email" + t.integer "add" + t.integer "del" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "changeset" + end + create_table "repositories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "url", :default => "", :null => false @@ -1689,6 +1698,8 @@ ActiveRecord::Schema.define(:version => 20160405021915) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false + t.integer "simi_id" + t.integer "simi_value" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -1921,6 +1932,25 @@ ActiveRecord::Schema.define(:version => 20160405021915) do add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + create_table "user_wechats", :force => true do |t| + t.integer "subscribe" + t.string "openid" + t.string "nickname" + t.integer "sex" + t.string "language" + t.string "city" + t.string "province" + t.string "country" + t.string "headimgurl" + t.string "subscribe_time" + t.string "unionid" + t.string "remark" + t.integer "groupid" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| t.string "login", :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false @@ -1997,6 +2027,14 @@ ActiveRecord::Schema.define(:version => 20160405021915) do t.datetime "updated_at", :null => false end + create_table "wechat_logs", :force => true do |t| + t.string "openid", :null => false + t.text "request_raw" + t.text "response_raw" + t.text "session_raw" + t.datetime "created_at", :null => false + end + create_table "wiki_content_versions", :force => true do |t| t.integer "wiki_content_id", :null => false t.integer "page_id", :null => false From c6174406fb0294c2371dc095cc34490a131210cb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 20 Apr 2016 10:39:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5=E4=BD=BF=E7=94=A8rails=E5=B7=B2=E6=9C=89=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 5 +++-- app/views/admin/code_work_tests.html.erb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 7d1ff6426..e581216fe 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -596,7 +596,7 @@ class AdminController < ApplicationController #代码测试列表 def code_work_tests #求出所有条数 - tCount = StudentWorkTest.find_by_sql("select count(*) from code_tests").first['count(*)'] + tCount = CodeTests.count() #设置个空的数组 以便paginateHelper来分页 @code_work_tests = [] @@ -615,7 +615,8 @@ class AdminController < ApplicationController if is_test[test['student_work_id']] != nil test['is_test'] = is_test[test['student_work_id']] else - test['is_test'] = CodeTests.find_by_sql("select is_test from student_works where id = #{test['student_work_id']}").first['is_test'] + test['is_test'] = StudentWork.find(test['student_work_id']).is_test + #test['is_test'] = CodeTests.find_by_sql("select is_test from student_works where id = #{test['student_work_id']}").first['is_test'] is_test[test['student_work_id']] = test['is_test'] end end diff --git a/app/views/admin/code_work_tests.html.erb b/app/views/admin/code_work_tests.html.erb index 385f97169..cb113f1e6 100644 --- a/app/views/admin/code_work_tests.html.erb +++ b/app/views/admin/code_work_tests.html.erb @@ -40,7 +40,7 @@ <%=link_to(test['homework_id'], student_work_index_path(:homework => test['homework_id']))%> '> - <% if test['is_test'] == 0 %> + <% if !test['is_test'] %> <%=link_to(test['student_work_id'], student_work_index_path(:homework => test['homework_id'],:student_work_id=>test['student_work_id']))%> <% else %> <%=link_to(test['student_work_id'], new_user_commit_homework_users_path(homework_id: test['homework_id'], is_test: true))%> From ff177557c802c48f33192051d4c73280a2db8f5c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 20 Apr 2016 16:13:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=88=97=E8=A1=A8=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index e581216fe..e6e0ec087 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -600,8 +600,9 @@ class AdminController < ApplicationController #设置个空的数组 以便paginateHelper来分页 @code_work_tests = [] - @code_work_tests[tCount-1] = {} - + if tCount >= 1 + @code_work_tests[tCount-1] = {} + end @code_work_tests = paginateHelper @code_work_tests,30 @page = (params['page'] || 1).to_i - 1