From 7f3fcb7d019fb74907cf91aa94b45cc5af0d71bb Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Apr 2016 14:54:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=AD=E7=9A=84=E5=85=A8=E9=83=A8=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=8F=AF=E7=82=B9=E5=87=BB=E5=8A=A8=E6=80=81=E6=95=B0?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 15 ++++++++++++--- app/views/admin/excellent_all_courses.html.erb | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 81407d95d..99732fc6b 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -65,9 +65,18 @@ class AdminController < ApplicationController #精品课程下的全部课程 def excellent_all_courses - @name = params[:name] - @courses = Course.like(@name).order('created_at desc') - @courses = paginateHelper @courses,30 + name = params[:name] + @order = "" + if params[:order] == 'asc' + courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) asc, c.id desc") + @order = params[:order] + elsif params[:order] == 'desc' + courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) DESC, c.id desc") + @order = params[:order] + else + courses = Course.like(name).order('created_at desc') + end + @courses = paginateHelper courses,30 @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html diff --git a/app/views/admin/excellent_all_courses.html.erb b/app/views/admin/excellent_all_courses.html.erb index 7554885a9..86e4556f9 100644 --- a/app/views/admin/excellent_all_courses.html.erb +++ b/app/views/admin/excellent_all_courses.html.erb @@ -48,8 +48,8 @@ 帖子数 - - 动态数 + + <%=link_to '动态数', excellent_all_courses_path(:order=> @order == "desc" ? 'asc' : 'desc') %> From eeecc5ad08a6a659786eb909dbfeaa520bc041e4 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Apr 2016 17:06:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=A6=81=E7=94=A8=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E7=82=B9=E5=87=BB=E8=AF=84=E5=88=86?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=B6=E4=B8=8D=E5=BA=94=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=BC=BA=E8=AF=84=E6=89=A3=E5=88=86=E7=9A=84=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 2 +- app/views/student_work/_set_score_rule_detail.html.erb | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 36a48f2a3..cd7aa39bc 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -775,7 +775,7 @@ class StudentWorkController < ApplicationController @homework.save end - unless homework_detail_manual.absence_penalty.to_s == params[:absence_penalty].to_s + if params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s homework_detail_manual.absence_penalty = params[:absence_penalty] if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" diff --git a/app/views/student_work/_set_score_rule_detail.html.erb b/app/views/student_work/_set_score_rule_detail.html.erb index c8451e478..28ca9e785 100644 --- a/app/views/student_work/_set_score_rule_detail.html.erb +++ b/app/views/student_work/_set_score_rule_detail.html.erb @@ -4,10 +4,12 @@ 迟交扣分 -
- 缺评扣分 - -
+ <% if homework.anonymous_comment == 0 %> +
+ 缺评扣分 + +
+ <% end %> <% if homework.homework_type == 2%>
From 8611fbbdec41fc0cda238e17b499d12adf129445 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Apr 2016 17:10:44 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=B8=AD=E5=85=B3=E4=BA=8E=E5=AD=A6=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=85=A5=E6=8F=90=E7=A4=BA=E4=B8=8D=E5=90=88?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E6=8F=90=E7=A4=BA=E4=B8=BA=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=95=B0=E5=AD=97=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E8=B4=9F=E6=95=B0=E6=88=96=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E8=83=BD=E6=89=A7=E8=A1=8C=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=BA=94=E8=AF=A5=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=8F=AA=E8=83=BD=E8=BE=93=E5=85=A5=E6=AD=A3=E6=95=B4?= =?UTF-8?q?=E6=95=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b5255f786..4e698e6f2 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -114,7 +114,7 @@ function regex_course_class_period() } else { - $("#course_class_period_notice").html("学时总数必须为数字"); + $("#course_class_period_notice").html("学时总数必须为正整数"); $("#course_class_period_notice").show(); return false; } From 0fa16251e759c8aadc7f4fb88ffb36f6016ca440 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Apr 2016 15:57:15 +0800 Subject: [PATCH 4/4] =?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