diff --git a/1234567 b/1234567 index c7ff2f81d..e9cd9a1c1 100644 --- a/1234567 +++ b/1234567 @@ -1 +1 @@ -{"access_token":"nwsA--Idg9Wk4Kyuybly8XuI8MWx-NrJbPTzZX2ynbGaVHBnXZgJ4DHkwlJK6dGfYOmeMNmRj6PSXEzs1GS6vAy0e_7_6S34-S44wtGK83dv6HCUQ8qh3vAw12QUi39fUMDhCIAFXO","expires_in":7200,"got_token_at":1461723935} \ No newline at end of file +{"access_token":"yFUfEXFu0_Pl_jdojoRv6eA8pmGjyRkRIL1VCB2HZ4kVJhEq6crriyCRCI-_u5QbWgtepiIOvqTHtXpKgzMuaB7Eo7MjlMcXeecqhzTjnvpivK5HUzGhZXBG1dk_BxicJAFlCAARIN","expires_in":7200,"got_token_at":1461934858} \ No newline at end of file diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 6df683948..eeea2d01a 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -27,11 +27,15 @@ class BlogsController < ApplicationController @topics.each do |topic| topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count) + if topic[:infocount] < 0 + topic[:infocount] = 0 + end end @b_sort == 1 ? @topics = @topics.sort{|x,y| x[:infocount] <=> y[:infocount] } : @topics = @topics.sort{|x,y| y[:infocount] <=> x[:infocount] } @topics = sort_by_sticky @topics + @topics = sortby_time_countcommon_hassticky @topics,sort_name else @type = 1 end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 260c28b16..1d7e94c06 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -77,7 +77,7 @@ class BoardsController < ApplicationController @b_sort = 2 end - sort_name = "updated_at" + sort_name = "updated_on" sort_type = @b_sort == 1 ? "asc" : "desc" @@ -126,9 +126,13 @@ class BoardsController < ApplicationController @type = 2 @topics.each do |topic| topic[:infocount] = get_praise_num(topic) + (topic.parent ? x.parent.children.count : topic.children.count) + if topic[:infocount] < 0 + topic[:infocount] = 0 + end end @b_sort == 1 ? @topics = @topics.sort{|x,y| x[:infocount] <=> y[:infocount] } : @topics = @topics.sort{|x,y| y[:infocount] <=> x[:infocount] } @topics = sort_by_sticky @topics + @topics = sortby_time_countcommon_hassticky @topics,sort_name else @type = 1 end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d8188ca74..fabacf1ba 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -89,7 +89,7 @@ class HomeworkCommonController < ApplicationController homework_detail_manual.comment_status = 1 end eval_start = homework_detail_manual.evaluation_start - if eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1 + if eval_start.nil? || (eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1) homework_detail_manual.evaluation_start = @homework.end_time + 7 homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7 end diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index f47471e0f..d35d7ac63 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -79,21 +79,20 @@ class NewsController < ApplicationController @b_sort = 2 end - sort_name = "created_on" + sort_name = "updated_at" sort_type = @b_sort == 1 ? "asc" : "desc" scope = @course ? @course.news.course_visible : News.course_visible news_arr = scope.map{|news| news.id} - @page = params[:page] ? params[:page].to_i + 1 : 0 news_page = 0 #@page *10 @news_count = scope.count @is_new = params[:is_new] @q = params[:subject] if params[:subject].nil? || params[:subject].blank? - scope_order = scope.reorder("#{News.table_name}.sticky DESC, #{News.table_name}.#{sort_name} #{sort_type}").offset(news_page).includes(:author,:course).all() + scope_order = scope.reorder("#{News.table_name}.sticky DESC, #{News.table_name}.created_on #{sort_type}").offset(news_page).includes(:author,:course).all() #all(:include => [:author, :course], #:order => "#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC").limit(10).offset(news_page) else @@ -101,16 +100,26 @@ class NewsController < ApplicationController #.all(:include => [:author, :course],:order => "#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC") end + scope_order.each do |topic| + topic[:updated_at] = CourseActivity.where("course_act_type='#{topic.class}' and course_act_id =#{topic.id}").first.updated_at + end + #根据 赞+回复数排序 if @order.to_i == 2 @type = 2 scope_order.each do |topic| topic[:infocount] = get_praise_num(topic) + topic.comments.count + if topic[:infocount] < 0 + topic[:infocount] = 0 + end end @b_sort == 1 ? scope_order = scope_order.sort{|x,y| x[:infocount] <=> y[:infocount] } : scope_order = scope_order.sort{|x,y| y[:infocount] <=> x[:infocount] } scope_order = sort_by_sticky scope_order + scope_order = sortby_time_countcommon_hassticky scope_order,sort_name else @type = 1 + @b_sort == 1 ? scope_order = scope_order.sort{|x,y| x[:updated_at] <=> y[:updated_at] } : scope_order = scope_order.sort{|x,y| y[:updated_at] <=> x[:updated_at] } + scope_order = sort_by_sticky scope_order end @newss = scope_order diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e7c10f9eb..cc1a1e9c7 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -5,7 +5,7 @@ class StudentWorkController < ApplicationController include ApplicationHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students,:work_canrepeat] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] @@ -17,41 +17,41 @@ class StudentWorkController < ApplicationController is_test = params[:is_test] == 'true' resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')} - student_work = find_or_save_student_work(is_test) + student_work = find_or_save_student_work(is_test) - unless student_work - resultObj[:status] = 100 - else - if @homework.homework_type == 2 && @homework.homework_detail_programing - result = test_realtime(student_work, params[:src]) - logger.debug result - resultObj[:status] = result["status"] - resultObj[:results] = result["results"] - resultObj[:error_msg] = result["error_msg"] - results = result["results"] - if result["status"].to_i == -2 #编译错误 - results = [result["error_msg"]] - end - student_work_test = student_work.student_work_tests.build(status: result["status"], results: results, - src: params[:src]) - unless student_work.save - resultObj[:status] = 200 + unless student_work + resultObj[:status] = 100 + else + if @homework.homework_type == 2 && @homework.homework_detail_programing + result = test_realtime(student_work, params[:src]) + logger.debug result + resultObj[:status] = result["status"] + resultObj[:results] = result["results"] + resultObj[:error_msg] = result["error_msg"] + results = result["results"] + if result["status"].to_i == -2 #编译错误 + results = [result["error_msg"]] + end + student_work_test = student_work.student_work_tests.build(status: result["status"], results: results, + src: params[:src]) + unless student_work.save + resultObj[:status] = 200 + else + student_work.name = params[:title] + student_work.description = params[:src] + if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + student_work.late_penalty = @homework.late_penalty else - student_work.name = params[:title] - student_work.description = params[:src] - if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") - student_work.late_penalty = @homework.late_penalty - else - student_work.late_penalty = 0 - end - student_work.save - resultObj[:status] = result["status"].to_i - resultObj[:time] = student_work_test.created_at.to_s(:db) - resultObj[:index] = student_work.student_work_tests.count + student_work.late_penalty = 0 end + student_work.save + resultObj[:status] = result["status"].to_i + resultObj[:time] = student_work_test.created_at.to_s(:db) + resultObj[:index] = student_work.student_work_tests.count end end - + end + render :json => resultObj end @@ -81,6 +81,8 @@ class StudentWorkController < ApplicationController #根据传入的tIndex确定是第几次测试 #之后如果觉得很卡 可以改成将结果传回JS再以参数形式传回来 def program_test_ex + tStarttime = Time.now + is_test = params[:is_test] == 'true' resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T'),tseq:1,tcount:1,testid:1} #保存每测试一次返回的结果 @@ -92,83 +94,229 @@ class StudentWorkController < ApplicationController resultObj[:status] = 100 else if @homework.homework_type == 2 && @homework.homework_detail_programing - #找到第index个测试的输入输出 - index = params[:tIndex].to_i - resultObj[:tseq] = index - test = @homework.homework_tests[index - 1] + #找到第index个测试的输入输出 + index = params[:tIndex].to_i + resultObj[:tseq] = index + test = @homework.homework_tests[index - 1] - #请求测试 + #请求测试 + begin result = test_realtime_ex(test, params[:src]) + rescue Timeout::Error + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒" - if result["status"].to_i != -2 - #result["results"].first['output'] = result["results"].first['output'].gsub(" ","□") - #result["results"].first['result'] = result["results"].first['result'].gsub(" ","□") - space_replace_1(result["results"].first['output']) - space_replace_1(result["results"].first['result']) - end + #status 0:答案正确 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时 + CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id) - logger.debug result + end + if result["status"].to_i != -2 + #result["results"].first['output'] = result["results"].first['output'].gsub(" ","□") + #result["results"].first['result'] = result["results"].first['result'].gsub(" ","□") + space_replace_1(result["results"].first['output']) + space_replace_1(result["results"].first['result']) + end - #-1 默认值 0全部正确并结束 2 超时 -2 编译错误 - resultObj[:status] = -1 - resultObj[:results] = result["results"].first #本次测试结果 - resultObj[:error_msg] = result["error_msg"] #编译错误时的信息 + logger.debug result - if result["status"].to_i == -2 #编译错误 - resultObj[:results] = result["error_msg"] - resultObj[:status] = -2 - elsif result["results"][0]["status"].to_i == 2 - resultObj[:status] = 2 - end + #-1 默认值 0全部正确并结束 2 超时 -2 编译错误 + resultObj[:status] = -1 + resultObj[:results] = result["results"].first #本次测试结果 + resultObj[:error_msg] = result["error_msg"] #编译错误时的信息 - unless student_work.save - resultObj[:status] = 200 + #该状态用于存入CodeTests + tmpstatus = -1 + if result["status"].to_i == -2 #编译错误 + resultObj[:results] = result["error_msg"] + resultObj[:status] = -2 + tmpstatus = -2 + elsif result["results"][0]["status"].to_i == 2 + resultObj[:status] = 2 + tmpstatus = 2 + end + + if result["status"] == 0 + tmpstatus = 0 + end + + unless student_work.save + resultObj[:status] = 200 + else + student_work.name = params[:title] + student_work.description = params[:src] + + if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + student_work.late_penalty = @homework.late_penalty else - student_work.name = params[:title] - student_work.description = params[:src] - - if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") - student_work.late_penalty = @homework.late_penalty - else - student_work.late_penalty = 0 - end - - #每次从数据库取出上次的结果加上本次的结果再存入数据库 - status = result["status"] - if index == 1 - student_work_test = student_work.student_work_tests.build(status: status, - results: [resultObj[:results]],src: params[:src]) - student_work_test.save! - resultObj[:testid] = student_work_test.id - else - #先从数据库取出result - student_work_test = StudentWorkTest.find(params[:testid]) - results = student_work_test.results - results << resultObj[:results] - student_work_test.results = results - student_work_test.status = (result["status"] != 0 ? result["status"] : student_work_test.status) - student_work_test.save! - status = student_work_test.status - resultObj[:testid] = student_work_test.id - end - - #超时或编译错误则直接返回了并存入数据库 - if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size - if status == 0 - resultObj[:status] = 0 - end - student_work.save! - resultObj[:time] = student_work_test.created_at.to_s(:db) - resultObj[:index] = student_work.student_work_tests.count - end - - #渲染返回结果 - render :json => resultObj + student_work.late_penalty = 0 end + + #每次从数据库取出上次的结果加上本次的结果再存入数据库 + if result["status"].to_i != -2 + result["results"].first['user_wait'] = tUsedtime + + if result["results"][0]["status"].to_i == 2 + result["status"] = 2 + end + end + + status = result["status"] + if index == 1 + student_work_test = student_work.student_work_tests.build(status: status, + results: [resultObj[:results]],src: params[:src]) + student_work_test.save! + resultObj[:testid] = student_work_test.id + else + #先从数据库取出result + student_work_test = StudentWorkTest.find(params[:testid]) + results = student_work_test.results + results << resultObj[:results] + student_work_test.results = results + student_work_test.status = (result["status"] != 0 ? result["status"] : student_work_test.status) + student_work_test.save! + status = student_work_test.status + resultObj[:testid] = student_work_test.id + end + + #超时或编译错误则直接返回了并存入数据库 + if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size + if status == 0 + resultObj[:status] = 0 + end + student_work.save! + resultObj[:time] = student_work_test.created_at.to_s(:db) + resultObj[:index] = student_work.student_work_tests.count + end + + #将每次用户等待时间都存起来以便管理界面显示用 + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒" + + time_used = 0 + if result["status"].to_i != -2 + #至少一毫秒 + time_used = result["results"].first['time_used'] == 0 ? 1:result["results"].first['time_used'] + end + #0:答案正确 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时 + CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>time_used,:wait_time=>tUsedtime,:student_work_id=>student_work.id) + + #渲染返回结果 + render :json => resultObj + end end end end + #找出该作业的所有提交作业 + def find_all_student_work_by_homeid() + all_studentwork = StudentWork.where("homework_common_id = #{@homework.id} and is_test = 0 ") + + all_studentwork + end + + def request_code_repeattest(src) + url = "#{Redmine::Configuration['jplag_server']}api/realtime_test.json" + + factor = [] + src.each do |test| + factor << {work_id: test.id, des: test.description,created_at:test.created_at.to_i} + end + + solutions = { + homeid:@homework.id, + language:@homework.homework_detail_programing.language, + factor: factor + } + uri = URI(url) + body = solutions.to_json + + logger.debug "send body" + logger.debug body + + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Post.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + + JSON.parse(res.body) + end + + #点击代码查重按钮 + def work_canrepeat + @homework_id = params[:homework] + @course_id = params[:course_id] + + all_studentwork = find_all_student_work_by_homeid() + + @work_count = all_studentwork.count + end + + #代码查重 status: 0完成 -2不需要查重 -1查重失败不支持该语言 + def code_repeattest + tStarttime = Time.now + logger.debug "code_repeattest start is #{tStarttime}}" + resultObj = {status: -2} + + @homework = HomeworkCommon.find params[:homework] + + all_studentwork = find_all_student_work_by_homeid() + + if all_studentwork == nil + resultObj[:status] = -2 + elsif all_studentwork.count <= 1 + resultObj[:status] = -2 + else + + #@homework.homework_detail_programing.language、id、description + logger.debug "time1 is #{Time.now.usec} " + result = request_code_repeattest(all_studentwork) + logger.debug "time2 is #{Time.now.usec} " + + resultObj[:status] = result['status'].to_i + # resultObj[:results] = result['results'] + + #Time.now, simi_id = simiworkid , simi_value = simivalue + if resultObj[:status] == 0 + @homework.simi_time = Time.now + resultObj[:comparetime] = @homework.simi_time + @homework.update_column('simi_time', @homework.simi_time) + + logger.debug "time3 is #{Time.now.usec} " + result['results'].each do |key,value| + @student_work = StudentWork.where("id =?", key.to_i).first + @student_work.update_column('simi_id', value['simiworkid'].to_i) + @student_work.update_column('simi_value', value['simivalue'].to_i) + # sqlstr = "update student_works set simi_id=#{value['simiworkid']},simi_value=#{value['simivalue']} where id=#{key.to_i} " + # dbh.execute(sqlstr) + end + logger.debug "time4 is #{Time.now.usec} " + end + end + tEndtime = Time.now + logger.debug "code_repeattest end is #{tEndtime}}" + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000000+(tEndtime.usec - tStarttime.usec) + logger.debug "code_repeattest userd utime is #{tUsedtime}" + render :json => resultObj + end + + #上次代码查重时间 + def last_codecomparetime + resultObj = {status: 0} + @homework = HomeworkCommon.find params[:homework] + + #转换一下 + if @homework.simi_time != nil + resultObj[:comparetime] = Time.parse(@homework.simi_time.to_s).strftime("%Y-%m-%d %H:%M:%S") + else + resultObj[:comparetime] = 0 + end + + render :json => resultObj + end def index # 作业消息状态更新 @@ -504,7 +652,7 @@ class StudentWorkController < ApplicationController if @homework.homework_detail_group.base_on_project == 1 stu_project.project_id = @student_work_project.project_id else @homework.homework_detail_group.base_on_project == 0 - stu_project.project_id = -1 + stu_project.project_id = -1 end stu_project.user_id = members[i].to_i stu_project.is_leader = 0 @@ -791,7 +939,7 @@ class StudentWorkController < ApplicationController if homework_detail_manual.ta_proportion.to_s != params[:ta_proportion].to_s || @homework.teacher_priority.to_s != teacher_priority.to_s || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s) homework_detail_manual.ta_proportion = params[:ta_proportion] homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing - @homework.teacher_priority = teacher_priority + @homework.update_column('teacher_priority', teacher_priority) homework_detail_manual.save if homework_detail_manual homework_detail_programing.save if homework_detail_programing @@ -801,7 +949,7 @@ class StudentWorkController < ApplicationController student_work.save end end - + @homework.save if params[:student_path] redirect_to student_work_index_url(:homework => @homework.id) @@ -1095,11 +1243,11 @@ class StudentWorkController < ApplicationController student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first if student_work.nil? @homework.student_works.build( - name: params[:title], - description: params[:src], - user_id: User.current.id, - is_test: is_test - ) + name: params[:title], + description: params[:src], + user_id: User.current.id, + is_test: is_test + ) unless @homework.save logger.debug @homework.errors.full_messages else @@ -1120,7 +1268,7 @@ class StudentWorkController < ApplicationController src:src, language:@homework.homework_detail_programing.language, factor: factor - } + } uri = URI(url) body = solutions.to_json res = Net::HTTP.new(uri.host, uri.port).start do |client| @@ -1174,8 +1322,12 @@ class StudentWorkController < ApplicationController final_score = final_ta_score + final_s_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end end else #不考虑教师评分 if student_work.teaching_asistant_score.nil? @@ -1189,8 +1341,12 @@ class StudentWorkController < ApplicationController final_score = final_ta_score + final_s_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end end elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空 if homework.teacher_priority == 1 #教师优先 @@ -1225,8 +1381,12 @@ class StudentWorkController < ApplicationController final_score = final_sy_score + final_ts_score + final_st_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end end else #不考虑教师评分 if student_work.teaching_asistant_score.nil? #教辅未评分 @@ -1256,8 +1416,12 @@ class StudentWorkController < ApplicationController final_score = final_sy_score + final_ts_score + final_st_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8e4c57f76..f8bf70933 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -477,8 +477,8 @@ class UsersController < ApplicationController ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:send_id].to_i) if ah.empty? @status = 2 - elsif ah.first.status == 1 - @status = 1 + elsif ah.first.status != 2 + @status = ah.first.status end end if !params[:search].nil? @@ -1208,13 +1208,13 @@ class UsersController < ApplicationController #显示更多用户课程 def user_courses4show @page = params[:page].to_i + 1 - @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) + @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) end #显示更多用户项目 def user_projects4show @page = params[:page].to_i + 1 - @projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5).offset(@page * 5) + @projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5).offset(@page * 5) end def user_course_activities @@ -2948,20 +2948,19 @@ class UsersController < ApplicationController sort_name = "created_at" sort_type = @c_sort == 1 ? "asc" : "desc" - if @user.courses.visible.count > 0 - course_order_ids = "(" + CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ") GROUP BY ca.course_id) AS c ").map {|c| c.course_id}.join(",") + ")" - @courses = Course.where("id in #{course_order_ids}").order("#{sort_name} #{sort_type}") - else - @courses = [] - end + @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a #{sort_type}") #根据 作业+资源数排序 if @order.to_i == 2 @type = 2 @courses.each do |course| course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count) + if course[:infocount] < 0 + course[:infocount] = 0 + end end @c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]}) + @courses = sortby_time_countcommon_nosticky @courses,sort_name else @type = 1 end @@ -2993,21 +2992,19 @@ class UsersController < ApplicationController sort_name = "created_on" sort_type = @c_sort == 1 ? "asc" : "desc" - if @user.projects.visible.count > 0 - project_order_ids = "(" +ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM (SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ") GROUP BY fa.project_id) AS p ").map {|p| p.project_id}.join(",") + ")" - @projects = Project.where("projects.id in #{project_order_ids}").order("#{sort_name} #{sort_type}") - else - @projects = [] - end + @projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}") #根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num if @order.to_i == 2 @type = 2 @projects.each do |project| project[:infocount] = project.project_score.issue_num+project.project_score.attach_num + if project[:infocount] < 0 + project[:infocount] = 0 + end end - @c_sort == 1 ? (@projects = @projects.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@projects = @projects.sort{|x,y| y[:infocount] <=> x[:infocount] }) + @projects = sortby_time_countcommon_nosticky @projects,sort_name else @type = 1 end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 464b4fcc6..d2f3ad456 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3065,7 +3065,7 @@ def host_with_protocol return Setting.protocol + "://" + Setting.host_name end -#将有置顶属性的提到数组前面 #infocount 相同的按时间降序排列 +#将有置顶属性的提到数组前面 def sort_by_sticky topics tmpTopics = [] tmpIndex = 0 @@ -3082,10 +3082,120 @@ def sort_by_sticky topics tmpIndex = tmpIndex + 1 end end + return tmpTopics +end - topics = tmpTopics - return topics -enddef strip_html(text,len=0,endss="...") +#按人气排序的时候 相同的人气必须按某种时间顺序排序 有置顶属性 +def sortby_time_countcommon_hassticky topics,sortstr + tmpTopics = [] + tmpTopics = topics + tStart = -1 + tEnd = -1 + + tmpTopics_1 = [] + tmpIndex = 0 + + tmpTopics.each_with_index do |topic,index| + if topic.sticky == 0 + if tStart == -1 + if (index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount]) + tStart = index + end + else + if ((topic[:infocount] == tmpTopics[index-1][:infocount]) && ((index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount]))) + tEnd = index + else + if (topic[:infocount] == tmpTopics[index-1][:infocount]) + tEnd = index + end + if tEnd > tStart + for i in tStart..tEnd + tmpTopics_1[tmpIndex] = tmpTopics[i] + tmpIndex = tmpIndex + 1 + end + + if sortstr == "created_at" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_at].to_i <=> x[:created_at].to_i } + elsif sortstr == "created_on" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_on].to_i <=> x[:created_on].to_i } + elsif sortstr == "updated_at" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_at].to_i <=> x[:updated_at].to_i } + elsif sortstr == "updated_on" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_on].to_i <=> x[:updated_on].to_i } + end + + tmpIndex = 0 + for i in tStart..tEnd + tmpTopics[i] = tmpTopics_1[tmpIndex] + tmpIndex = tmpIndex + 1 + end + end + tStart = -1 + tEnd = -1 + tmpTopics_1 = [] + tmpIndex = 0 + end + end + end + end + return tmpTopics +end + +#按人气排序的时候 相同的人气必须按某种时间顺序排序 无置顶属性 +def sortby_time_countcommon_nosticky topics,sortstr + tmpTopics = [] + tmpTopics = topics + tStart = -1 + tEnd = -1 + + tmpTopics_1 = [] + tmpIndex = 0 + + tmpTopics.each_with_index do |topic,index| + if tStart == -1 + if (index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount]) + tStart = index + end + else + if ((topic[:infocount] == tmpTopics[index-1][:infocount]) && ((index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount]))) + tEnd = index + else + if (topic[:infocount] == tmpTopics[index-1][:infocount]) + tEnd = index + end + if tEnd > tStart + for i in tStart..tEnd + tmpTopics_1[tmpIndex] = tmpTopics[i] + tmpIndex = tmpIndex + 1 + end + + if sortstr == "created_at" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_at].to_i <=> x[:created_at].to_i } + elsif sortstr == "created_on" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_on].to_i <=> x[:created_on].to_i } + elsif sortstr == "updated_at" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_at].to_i <=> x[:updated_at].to_i } + elsif sortstr == "updated_on" + tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_on].to_i <=> x[:updated_on].to_i } + end + + tmpIndex = 0 + for i in tStart..tEnd + tmpTopics[i] = tmpTopics_1[tmpIndex] + tmpIndex = tmpIndex + 1 + end + end + tStart = -1 + tEnd = -1 + tmpTopics_1 = [] + tmpIndex = 0 + end + end + end + return tmpTopics +end + +def strip_html(text,len=0,endss="...") ss = "" if text.length>0 ss=text.gsub(/<\/?.*?>/, '').strip @@ -3098,4 +3208,4 @@ enddef strip_html(text,len=0,endss="...") end end return ss -end \ No newline at end of file +end diff --git a/app/models/comment.rb b/app/models/comment.rb index 341a179ce..8632c243a 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -45,7 +45,8 @@ class Comment < ActiveRecord::Base if self.commented.course if self.author_id != self.commented.author_id self.course_messages << CourseMessage.new(:user_id => self.commented.author_id, :course_id => self.commented.course.id, :viewed => false) - if ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count == 0 + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count + if count == 0 content = strip_html self.comments.html_safe, 200 ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index b47008393..dae910d60 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -59,7 +59,8 @@ class HomeworkCommon < ActiveRecord::Base self.course.members.each do |m| # if m.user_id != self.user_id self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) - if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count == 0 + count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count + if count == 0 ws = WechatService.new ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59") end @@ -108,7 +109,8 @@ class HomeworkCommon < ActiveRecord::Base #修改作业后发送微信模板消息 def wechat_message self.course.members.each do |member| - if ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count == 0 + count = ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count + if count == 0 ws = WechatService.new ws.homework_template(member.user_id, "homework", self.id, "#{l(:label_update_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59") end diff --git a/app/models/issue.rb b/app/models/issue.rb index 6e3dcc57a..79ddcd917 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -162,7 +162,7 @@ class Issue < ActiveRecord::Base end self.project.members.each do |m| count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count - if m.user_id != self.author_id && count != 0 + if m.user_id != self.author_id && count == 0 ws = WechatService.new content = strip_html self.project.name + " 有新缺陷了:" + self.subject.html_safe, 200 ws.message_update_template m.user_id, "issues", self.id, "#{l(:label_new_issue_template)}", content, format_time(self.created_on) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 675c07b06..10971d46f 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -255,11 +255,14 @@ class JournalsForMessage < ActiveRecord::Base self.course_messages << CourseMessage.new(:user_id => r, :course_id => self.jour.id, :viewed => false) end end - if self.jour_type == 'HomeworkCommon' && ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count == 0 - ws = WechatService.new - #content = truncate(strip_tags(self.notes.to_s), length: 200) - content = strip_html self.notes.html_safe, 200 - ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + if self.jour_type == 'HomeworkCommon' + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count + if count == 0 + ws = WechatService.new + #content = truncate(strip_tags(self.notes.to_s), length: 200) + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end end diff --git a/app/models/message.rb b/app/models/message.rb index 5275c57b9..7bfb9d80e 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -83,7 +83,7 @@ class Message < ActiveRecord::Base # after_create :add_author_as_watcher, :reset_counters!, :add_boards_count after_update :update_messages_board, :update_activity after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score - after_create :act_as_course_activity, :act_as_forge_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count + after_create :act_as_course_activity, :act_as_forge_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count, :act_as_system_message #before_save :be_user_score scope :visible, lambda {|*args| @@ -263,8 +263,9 @@ class Message < ActiveRecord::Base if self.parent_id.nil? # 主贴 self.course.members.includes(:user).each do |m| if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息 - self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false) - if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course.id}").count == 0 + #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course.id}").count + if count == 0 content = strip_html self.subject, 200 ws.topic_publish_template m.user_id, "course_discussion", self.id, "#{l(:label_course_topic_template)}", content, self.author.try(:realname), format_time(self.created_on) end @@ -273,8 +274,9 @@ class Message < ActiveRecord::Base else # 回帖 parent_author_id = Message.find(self.parent_id).author_id if parent_author_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息 - self.course_messages << CourseMessage.new(:user_id => parent_author_id, :course_id => self.board.course_id, :viewed => false) - if ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Course' and shield_id=#{self.board.course_id}").count == 0 + #self.course_messages << CourseMessage.new(:user_id => parent_author_id, :course_id => self.board.course_id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Course' and shield_id=#{self.board.course_id}").count + if count == 0 content = strip_html self.content.html_safe, 200 ws.comment_template parent_author_id, "course_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content end @@ -284,8 +286,9 @@ class Message < ActiveRecord::Base if self.parent_id.nil? # 主贴 self.project.members.includes(:user).each do |m| if m.user_id != self.author_id - self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false) - if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project.id}").count == 0 + #self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project.id}").count + if count == 0 content = strip_html self.subject, 200 ws.topic_publish_template m.user_id, "project_discussion", self.id, "#{l(:label_project_topic_template)}", content, self.author.try(:realname), format_time(self.created_on) end @@ -294,8 +297,9 @@ class Message < ActiveRecord::Base else # 回帖 parent_author_id = Message.find(self.parent_id).author_id if parent_author_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息 - self.forge_messages << ForgeMessage.new(:user_id => parent_author_id, :project_id => self.board.project_id, :viewed => false) - if ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Project' and shield_id=#{self.board.project_id}").count == 0 + #self.forge_messages << ForgeMessage.new(:user_id => parent_author_id, :project_id => self.board.project_id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Project' and shield_id=#{self.board.project_id}").count + if count == 0 content = strip_html self.content.html_safe, 200 ws.comment_template parent_author_id, "project_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content end diff --git a/app/models/news.rb b/app/models/news.rb index cd16442a0..1a2205f48 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -170,7 +170,8 @@ class News < ActiveRecord::Base self.course.members.each do |m| if m.user_id != self.author_id self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) - if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count == 0 + count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count + if count == 0 ws = WechatService.new content = strip_html self.author.try(:realname) + " 发布了通知:" + self.title.html_safe, 200 ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.author.try(:realname) + " 发布了通知:" + content, format_time(self.created_on) diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 3abd4276a..ddd91df38 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -63,11 +63,17 @@ class StudentWork < ActiveRecord::Base final_score = final_ta_score + final_s_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end end else #不考虑教师评分 - if student_work.teaching_asistant_score.nil? + if student_work.student_score.nil? && student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.teacher_score + elsif student_work.teaching_asistant_score.nil? student_work.final_score = student_work.student_score elsif student_work.student_score.nil? student_work.final_score = student_work.teaching_asistant_score @@ -78,8 +84,12 @@ class StudentWork < ActiveRecord::Base final_score = final_ta_score + final_s_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end end elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空 if homework.teacher_priority == 1 #教师优先 @@ -114,9 +124,13 @@ class StudentWork < ActiveRecord::Base final_score = final_sy_score + final_ts_score + final_st_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score - end + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end + end else #不考虑教师评分 if student_work.teaching_asistant_score.nil? #教辅未评分 if student_work.student_score.nil? @@ -145,8 +159,12 @@ class StudentWork < ActiveRecord::Base final_score = final_sy_score + final_ts_score + final_st_score student_work.final_score = format("%.2f",final_score.to_f) end - score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + if student_work.final_score + score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty + student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + else + student_work.work_score = nil + end end end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index ee999d98f..1dcd147d4 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -10,23 +10,23 @@ class WechatService data:{ first: { value:first, - color:"#CCCCCC" + color:"#707070" }, keyword1:{ value:key1, - color:"#CCCCCC" + color:"#707070" }, keyword2:{ value:key2, - color:"#CCCCCC" + color:"#707070" }, keyword3:{ value:key3, - color:"#CCCCCC" + color:"#707070" }, remark:{ value:remark, - color:"#CCCCCC" + color:"#707070" } } } @@ -88,19 +88,19 @@ class WechatService data:{ first: { value:first, - color:"#CCCCCC" + color:"#707070" }, keyword1:{ value:key1, - color:"#CCCCCC" + color:"#707070" }, keyword2:{ value:key2, - color:"#CCCCCC" + color:"#707070" }, remark:{ value:remark, - color:"#CCCCCC" + color:"#707070" } } } diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index ea494d0f9..7a1dc636c 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -25,7 +25,7 @@ <%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl"%> <% end %> <% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %> - [已设为首页] + [已设为首页] <% end %> <% if activity.sticky == 1 %> 顶 diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 8db253888..1e0f46926 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -84,7 +84,7 @@ <% end%> \ No newline at end of file diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 4ac2ebcbf..33e2835dd 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -153,9 +153,9 @@