diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 0d34cecaf..3d05ab3f3 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -336,6 +336,19 @@ module Mobile student_works = cs.student_work_list params,current_user present :data,student_works.all,with:Mobile::Entities::StudentWork end + + desc '开启匿评' + params do + requires :token,type:String + requires :course_id,type:Integer,desc:'课程id' + requires :homework_id,type:Integer,desc:'作业id' + end + get ':course_id/start_anonymous_comment' do + cs = CoursesService.new + status = cs.start_anonymous_comment params,current_user + present :data,status + present :status,0 + end end end end diff --git a/app/api/mobile/entities/attachment.rb b/app/api/mobile/entities/attachment.rb index b7424fac9..bb67b6d28 100644 --- a/app/api/mobile/entities/attachment.rb +++ b/app/api/mobile/entities/attachment.rb @@ -14,9 +14,10 @@ module Mobile f.send(field) end else - #case field - # when "" - #end + case field + when :file_dir + "attachments/download/" << f.send(:id).to_s << '/' + end end end end @@ -27,6 +28,7 @@ module Mobile attachment_expose :downloads attachment_expose :quotes attachment_expose :created_on + attachment_expose :file_dir end end end \ No newline at end of file diff --git a/app/api/mobile/entities/homework.rb b/app/api/mobile/entities/homework.rb index 2ea9404b8..e78689bfb 100644 --- a/app/api/mobile/entities/homework.rb +++ b/app/api/mobile/entities/homework.rb @@ -28,6 +28,8 @@ module Mobile get_homework_status f when :homework_times f.course.homework_commons.index(f) + 1 + when :homework_status_desc + homework_status_desc f end end end @@ -80,7 +82,8 @@ module Mobile expose :submit_student_list ,using: Mobile::Entities::User do |f,opt| get_submit_sutdent_list f end - homework_expose :homework_status + homework_expose :homework_status #作业的状态 + homework_expose :homework_status_desc #状态的解释 end end diff --git a/app/controllers/activity_notifys_controller.rb b/app/controllers/activity_notifys_controller.rb index 01e4260ea..ad9818fcc 100644 --- a/app/controllers/activity_notifys_controller.rb +++ b/app/controllers/activity_notifys_controller.rb @@ -6,6 +6,7 @@ class ActivityNotifysController < ApplicationController # accept_rss_auth :index, :show helper :activities + helper :attachments def index query = nil if @course diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index d226000c0..c10f8bc84 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -34,6 +34,20 @@ class CommentsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT end + # ض̬ļ¼add start + if( @comment.id && @news.course ) + if(@news.author_id != User.current.id) + notify = ActivityNotify.new() + notify.activity_container_id = @news.course.id + notify.activity_container_type = 'Course' + notify.activity_id = @comment.id + notify.activity_type = 'Comment' + notify.notify_to = @news.author_id + notify.is_read = 0 + notify.save() + end + end + # ض̬ļ¼add end flash[:notice] = l(:label_comment_added) end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6b2cd21ed..7808691cf 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -91,15 +91,39 @@ class HomeworkCommonController < ApplicationController @homework.end_time = params[:homework_common][:end_time] @homework.publish_time = params[:homework_common][:publish_time] @homework.homework_type = params[:homework_common][:homework_type] - @homework.late_penalty = params[:late_penalty] + unless @homework.late_penalty == params[:late_penalty] + @homework.student_works.where("created_at > #{@homework.end_time}").each do |student_work| + student_work.late_penalty = params[:late_penalty] + student_work.save + end + @homework.late_penalty = params[:late_penalty] + end @homework.course_id = @course.id #匿评作业相关属性 - @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - @homework_detail_manual.evaluation_start = params[:evaluation_start] - @homework_detail_manual.evaluation_end = params[:evaluation_end] - @homework_detail_manual.evaluation_num = params[:evaluation_num] - @homework_detail_manual.absence_penalty = params[:absence_penalty] + if @homework.homework_type == 1 + @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 + @homework_detail_manual.evaluation_start = params[:evaluation_start] + @homework_detail_manual.evaluation_end = params[:evaluation_end] + @homework_detail_manual.evaluation_num = params[:evaluation_num] + unless @homework_detail_manual.absence_penalty == params[:absence_penalty] + if @homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 + work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" + @homework.student_works.each do |student_work| + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count + student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0 + student_work.save + end + end + @homework_detail_manual.absence_penalty = params[:absence_penalty] + end + else #不是匿评作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业 + @homework.student_works.where("absence_penalty != 0").each do |student_work| + student_work.late_penalty = 0 + student_work.save + end + @homework_detail_manual.absence_penalty = 0 + end @homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@homework) @@ -161,6 +185,14 @@ class HomeworkCommonController < ApplicationController #关闭匿评 def stop_anonymous_comment @homework_detail_manual.update_column('comment_status', 3) + + work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" + @homework.student_works.each do |student_work| + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count + student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0 + student_work.save + end + respond_to do |format| format.js end diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index f71a77ca7..56b4a30fc 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -141,6 +141,21 @@ class NewsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS end + # ض̬ļ¼add start + teachers = searchTeacherAndAssistant(@course) + for teacher in teachers + if(teacher.user_id != User.current.id) + notify = ActivityNotify.new() + notify.activity_container_id = @course.id + notify.activity_container_type = 'Course' + notify.activity_id = @news.id + notify.activity_type = 'News' + notify.notify_to = teacher.user_id + notify.is_read = 0 + notify.save() + end + end + # ض̬ļ¼add end render_attachment_warning_if_needed(@news) flash[:notice] = l(:notice_successful_create) redirect_to course_news_index_url(@course) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index deeefcd75..596d5ba51 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -9,32 +9,32 @@ class StudentWorkController < ApplicationController before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list] def index - @order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || "" + @order,@b_sort,@name = params[:order] || "score",params[:sort] || "desc",params[:name] || "" @is_teacher = User.current.allowed_to?(:as_teacher,@course) #老师 || 非匿评作业 || 匿评结束 显示所有的作品 - @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 + @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? if @show_all - if @homework.homework_type == 1 || @is_teacher || User.current.admin? + if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 if @order == "name" - @stundet_works = search_homework_member @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name else - @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name end - else - my_work = @homework.student_works.where(:user_id => User.current.id) + else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 + my_work = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) if my_work.empty? @stundet_works = [] else if @order == "name" - @stundet_works = search_homework_member @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name else - @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name end end end else #学生 if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 - @stundet_works = @homework.student_works.where(:user_id => User.current.id) + @stundet_works = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 @is_evaluation = true my_work = @homework.student_works.where(:user_id => User.current.id) @@ -42,6 +42,7 @@ class StudentWorkController < ApplicationController end end @homework_commons = @course.homework_commons.order("created_at desc") + @homework_commons = @course.homework_commons.order("created_at desc") @score = @b_sort == "desc" ? "asc" : "desc" respond_to do |format| format.html @@ -73,6 +74,11 @@ class StudentWorkController < ApplicationController stundet_work.homework_common_id = @homework.id stundet_work.user_id = User.current.id stundet_work.save_attachments(params[:attachments]) + if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + stundet_work.late_penalty = @homework.late_penalty + else + stundet_work.late_penalty = 0 + end render_attachment_warning_if_needed(stundet_work) if stundet_work.save respond_to do |format| @@ -251,7 +257,7 @@ class StudentWorkController < ApplicationController work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" @stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM( SELECT * , - (SELECT evaluation_num FROM homework_detail_manuals WHERE homework_detail_manuals.homework_common_id = #{@homework.id}) AS all_count, + (SELECT COUNT(*) FROM `student_works_evaluation_distributions` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS all_count, (SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count FROM `student_works` WHERE homework_common_id = #{@homework.id} diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index 916383b05..6c17f8566 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -89,6 +89,29 @@ module ApiHelper homework_status end + #获取作业的是否可以匿评的描述 + def homework_status_desc homework + if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业 + if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + link = "启动匿评".html_safe + elsif homework.student_works.count >= 2 #作业份数大于2 + case homework.homework_detail_manual.comment_status + when 1 + link = '启动匿评' + when 2 + link = '关闭匿评' + when 3 + link = " 匿评结束" + end + else + link = "学生提交作业数大于2时才可以启动匿评" + end + else + link = "未开启匿评作业不可以启动匿评" + end + link + end + #获取 def get_submit_sutdent_list homework studentlist = [] @@ -104,6 +127,11 @@ module ApiHelper #计算作业的截止日期,剩余日期 def show_homework_deadline homework - "距作业截止还有" << (Date.parse(Time.now.to_s) - Date.parse(homework.end_time.to_s)).to_i.to_s << "天" + day = 0 + if (day = (Date.parse(homework.end_time.to_s) - Date.parse(Time.now.to_s)).to_i) > 0 + "距作业截止还有" << (Date.parse(Time.now.to_s) - Date.parse(homework.end_time.to_s)).to_i.to_s << "天" + else + "已截止,但可补交" + end end end \ No newline at end of file diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index b9940f4be..465df62da 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -15,7 +15,7 @@ module HomeworkCommonHelper #教辅评分比例下拉框 def ta_proportion_option type = [] - i = 10 + i = 0 while i <= 100 option = [] option << i.to_s + "%" diff --git a/app/models/comment.rb b/app/models/comment.rb index bdb642d3c..a4842a23f 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -19,6 +19,14 @@ class Comment < ActiveRecord::Base include Redmine::SafeAttributes include ApplicationHelper has_many_kindeditor_assets :assets, :dependent => :destroy + + has_many :ActivityNotifies,:as => :activity, :dependent => :destroy + acts_as_event :datetime => :updated_on, + :description => :comments, + :type => 'news', + :title=>Proc.new {|o| "RE: #{o.commented.title}" }, + :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} } + belongs_to :commented, :polymorphic => true, :counter_cache => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' validates_presence_of :commented, :author, :comments @@ -38,4 +46,17 @@ class Comment < ActiveRecord::Base def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::COMMENT end + + def set_notify_id(notify_id) + @notify_id= notify_id + end + def get_notify_id() + return @notify_id + end + def set_notify_is_read(notify_is_read) + @notify_is_read = notify_is_read + end + def get_notify_is_read() + return @notify_is_read + end end diff --git a/app/models/news.rb b/app/models/news.rb index 7e809cbfd..7d33d760e 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -30,6 +30,8 @@ class News < ActiveRecord::Base has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy # end + has_many :ActivityNotifies,:as => :activity, :dependent => :destroy + validates_presence_of :title, :description validates_length_of :title, :maximum => 60 validates_length_of :summary, :maximum => 255 @@ -85,6 +87,19 @@ class News < ActiveRecord::Base #description end + def set_notify_id(notify_id) + @notify_id= notify_id + end + def get_notify_id() + return @notify_id + end + def set_notify_is_read(notify_is_read) + @notify_is_read = notify_is_read + end + def get_notify_is_read() + return @notify_is_read + end + private def add_author_as_watcher diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index b77703a37..7efe76b3a 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -434,24 +434,15 @@ class CoursesService # 课程课件 def course_attachments params result = [] - @course = Course.find(params[:course_id]) - @attachments = @course.attachments.order("created_on desc") + course = Course.find(params[:course_id]) + attachments = course.attachments.order("created_on ") if !params[:name].nil? && params[:name] != "" - @attachments.each do |atta| - result << {:filename => atta.filename, - :description => atta.description, - :downloads => atta.downloads, - :quotes => atta.quotes.nil? ? 0 :atta.quotes } if atta.filename.include?(params[:name]) + attachments.each do |atta| + result << atta if atta.filename.include?(params[:name]) end else - @attachments.each do |atta| - result << {:filename => atta.filename, - :description => atta.description, - :downloads => atta.downloads, - :quotes => atta.quotes.nil? ? 0 :atta.quotes } - - end + result = attachments end result end @@ -651,9 +642,9 @@ class CoursesService return end if current_user == @user || current_user.admin? - membership = @user.coursememberships.page(1).per(10) + membership = @user.coursememberships.page(1).per(15) else - membership = @user.coursememberships.page(1).per(10).all(:conditions => Course.visible_condition(current_user)) + membership = @user.coursememberships.page(1).per(15).all(:conditions => Course.visible_condition(current_user)) end if membership.nil? || membership.count == 0 raise l(:label_no_courses, :locale => get_user_language(current_user)) @@ -669,10 +660,11 @@ class CoursesService dynamics_count = 0 # 课程学霸 学生总分数排名靠前的5个人 homework_count = course.homework_commons.count - unless homework_count == 0 - sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" << + sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" << " where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score limit 0,6" - latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 6,:better_students=> User.find_by_sql(sql)} + better_students = User.find_by_sql(sql) + if homework_count != 0 && !better_students.empty? + latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 6,:better_students=> better_students} dynamics_count += 1 end # 课程通知 @@ -754,5 +746,41 @@ class CoursesService student_works end + # 开启匿评 + #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限 + def start_anonymous_comment params,current_user + homework = HomeworkCommon.find(params[:homework_id]) + return {:status=>4} unless current_user.admin? || current_user.allowed_to?(:as_teacher,Course.find(params[:course_id])) + return {:status=>5} if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + homework_detail_manual = homework.homework_detail_manual + if homework_detail_manual.comment_status == 1 + student_works = homework.student_works + if student_works && student_works.size >=2 + student_works.each_with_index do |work, index| + user = work.user + n = homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + assigned_homeworks = get_assigned_homeworks(student_works, n, index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + homework_detail_manual.update_column('comment_status', 2) + statue = 1 + else + statue = 2 + end + else + statue = 3 + end + {:status => statue} + end + + def get_assigned_homeworks(student_works, n, index) + student_works += student_works + student_works[index + 1 .. index + n] + end + end diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index e9639f4f0..043bac947 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -9,7 +9,7 @@
- <%= link_to journal.user.show_name, user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%> + <%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%> <%= format_time(journal.created_on) %> diff --git a/app/views/homework_common/_homework_common_form.html.erb b/app/views/homework_common/_homework_common_form.html.erb index fa45397f0..4542be9f5 100644 --- a/app/views/homework_common/_homework_common_form.html.erb +++ b/app/views/homework_common/_homework_common_form.html.erb @@ -47,7 +47,7 @@

基本规则设置(总分为100分)

diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb index cd60ef024..6e4cc65f1 100644 --- a/app/views/student_work/_student_work.html.erb +++ b/app/views/student_work/_student_work.html.erb @@ -38,8 +38,34 @@
<% end%> -
  • - <%= student_work.final_score.nil? ? "--" : format("%.1f",student_work.final_score)%> + <% score = student_work.respond_to?("score") ? student_work.score : student_work.final_score - student_work.absence_penalty - student_work.late_penalty%> +
  • + <%= score.nil? ? "--" : format("%.1f",score)%> + <% unless score.nil?%> + <% if @homework.homework_type == 1%> + +
    + 作品最终评分为 +  <%= student_work.final_score%> 分。 + 迟交扣分 +  <%= student_work.late_penalty%> 分, + 缺评扣分 +  <%= student_work.absence_penalty%> 分, + 最终成绩为 +  <%= score%> 分。 +
    + <% else%> + +
    + 作品最终评分为 +  <%= student_work.final_score%> 分。 + 迟交扣分 +  <%= student_work.late_penalty%> 分, + 最终成绩为 +  <%= score%> 分。 +
    + <% end%> + <% end%>
  • \ No newline at end of file diff --git a/app/views/student_work/_student_work_title.html.erb b/app/views/student_work/_student_work_title.html.erb index 23e29b01b..0e4151065 100644 --- a/app/views/student_work/_student_work_title.html.erb +++ b/app/views/student_work/_student_work_title.html.erb @@ -36,8 +36,8 @@ <% end%>
  • - <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "final_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <% if @show_all && @order == "score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • \ No newline at end of file diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 0ba275d5d..4474ab3b5 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -16,14 +16,26 @@ $("#score_list_<%= @work.id%>").removeAttr("style"); $(function(){ + //匿评评分提示 $(".student_score_info").bind("mouseover",function(e){ //alert($(this).html()); $(this).find("div").show(); - $(this).find("div").css("top",e.pageY); - $(this).find("div").css("left",e.pageX); +// $(this).find("div").css("top",e.pageY); +// $(this).find("div").css("left",e.pageX); }); $(".student_score_info").bind("mouseout",function(e){ //alert($(this).html()); $(this).find("div").hide(); }); + //最终成绩提示 + $(".student_final_scor_info").bind("mouseover",function(e){ + //alert($(this).html()); + $(this).find("div").show(); +// $(this).find("div").css("top",e.pageY); +// $(this).find("div").css("left",e.pageX); + }); + $(".student_final_scor_info").bind("mouseout",function(e){ + //alert($(this).html()); + $(this).find("div").hide(); + }); }); diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 167829ec3..c5bc5858d 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -60,7 +60,7 @@ <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> <% end%> -
    +
    使用 winzip 工具进行解压可能会导致 diff --git a/app/views/users/_history.html.erb b/app/views/users/_history.html.erb index d69b6b25b..a87c2d8e4 100644 --- a/app/views/users/_history.html.erb +++ b/app/views/users/_history.html.erb @@ -9,7 +9,7 @@
    - <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= format_time(journal.created_on) %> + <%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= format_time(journal.created_on) %>

    <%=journal.notes.html_safe%>

    diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index f93254218..5e9d6ef46 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -13,10 +13,10 @@
    <% id = 'project_respond_form_'+ reply.id.to_s %> - <%= link_to reply.user.show_name, user_path(reply.user) %> + <%= link_to "#{reply.user.show_name}(#{reply.user.login})", user_path(reply.user) %> <%= l(:label_reply_to)%> <% if show_name %> - <%= link_to parent_jour.user.show_name, user_path(parent_jour.user) %> + <%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %> <% else %> <%= l(:label_anonymous) %> <% end %> diff --git a/db/schema.rb b/db/schema.rb index c0d1ce7fc..988d5649a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150630031857) do +ActiveRecord::Schema.define(:version => 20150702073308) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1231,6 +1231,8 @@ ActiveRecord::Schema.define(:version => 20150630031857) do t.integer "project_id", :default => 0 t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 end create_table "student_works_evaluation_distributions", :force => true do |t| diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 172e630f0..c8e3b533e 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -788,13 +788,24 @@ $(function(){ $(".student_score_info").bind("mouseover",function(e){ //alert($(this).html()); $(this).find("div").show(); - $(this).find("div").css("top",e.pageY); - $(this).find("div").css("left",e.pageX); + //$(this).find("div").css("top",e.pageY); + //$(this).find("div").css("left",e.pageX); }); $(".student_score_info").bind("mouseout",function(e){ //alert($(this).html()); $(this).find("div").hide(); }); + //最终成绩提示 + $(".student_final_scor_info").bind("mouseover",function(e){ + //alert($(this).html()); + $(this).find("div").show(); + //$(this).find("div").css("top",e.pageY); + //$(this).find("div").css("left",e.pageX); + }); + $(".student_final_scor_info").bind("mouseout",function(e){ + //alert($(this).html()); + $(this).find("div").hide(); + }); $("#about_project label").eq(1).remove(); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index b54100293..651436ec4 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -655,7 +655,8 @@ a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;} .fr{ float:right;} .li_min_search{ float:right; margin-right:-10px;} -.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 110px;margin-top: 10px;} +.info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;} +.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 50px;margin-top: -5px;} /*返回顶部*/ .to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;} .hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;} @@ -678,7 +679,7 @@ input#score{ width:40px;} .student_work_search{background-color: #64bdd9;color: white !important;padding: 2px 7px;margin-left: 10px;cursor: pointer; } /* 与我相关 */ -.new_icon{background:url(../images/new_icon.png) 0px 0px no-repeat; width:35px; height:15px; display:block;} +/*.new_icon{background:url(../images/new_icon.png) 0px 0px no-repeat; width:35px; height:15px; display:block;}*/ a.about_me{text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;} a:hover.about_me{ color:#0781b4;}