Merge branch 'cxt_course' into yuanke

Conflicts:
	db/schema.rb
This commit is contained in:
yuanke 2016-04-20 09:59:37 +08:00
commit dc3837da76
7 changed files with 79 additions and 14 deletions

View File

@ -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

View File

@ -924,7 +924,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(",") + ")"

View File

@ -48,8 +48,8 @@
<th style="width: 50px;">
帖子数
</th>
<th style="width: 50px;">
动态数
<th style="width: 50px;" class = "<%= @order == 'desc' ? 'st_up' : (@order == 'asc' ? 'st_down' : '') %>">
<%=link_to '动态数', excellent_all_courses_path(:order=> @order == "desc" ? 'asc' : 'desc') %>
</th>
<th style="width: 40px;">
</tr>

View File

@ -4,10 +4,12 @@
<span class="f14 fontGrey3 mr10">迟交扣分</span>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="请输入0-50数值" class=" markInput" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
</div>
<div>
<span class="f14 fontGrey3 mr10">缺评扣分</span>
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="请输入0-50数值" class="markInput" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
</div>
<% if homework.anonymous_comment == 0 %>
<div>
<span class="f14 fontGrey3 mr10">缺评扣分</span>
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="请输入0-50数值" class="markInput" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
</div>
<% end %>
<% if homework.homework_type == 2%>
<div>

View File

@ -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

View File

@ -11,6 +11,10 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160405021915) do
ActiveRecord::Schema.define(:version => 20160419074016) do
create_table "activities", :force => true do |t|
@ -1532,6 +1536,18 @@ ActiveRecord::Schema.define(:version => 20160419074016) 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
@ -1698,8 +1714,8 @@ ActiveRecord::Schema.define(:version => 20160419074016) do
t.integer "absence_penalty", :default => 0
t.float "system_score", :default => 0.0
t.boolean "is_test", :default => false
t.integer "simi_id", :default => 0
t.integer "simi_value", :default => 0
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"
@ -1932,6 +1948,25 @@ ActiveRecord::Schema.define(:version => 20160419074016) 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
@ -2008,6 +2043,14 @@ ActiveRecord::Schema.define(:version => 20160419074016) 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

View File

@ -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;
}
@ -1431,4 +1431,4 @@ function submit_course_feedback() {
function show_more_tool(){
$('#navContentCourse').css('display', 'block');
}
}