1、老师、学生打分

2、评论及评论的回复功能
This commit is contained in:
sw 2015-09-17 16:31:32 +08:00
parent c4abe6b413
commit f6f3d83c5e
8 changed files with 49 additions and 95 deletions

View File

@ -212,8 +212,9 @@ class StudentWorkController < ApplicationController
#添加评分,已评分则为修改评分
def add_score
@is_last = params[:is_last] == "true"
render_403 and return if User.current == @work.user #不可以匿评自己的作品
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2
@score = student_work_score @work,User.current
@ -254,7 +255,7 @@ class StudentWorkController < ApplicationController
when 3 #学生评分 学生评分显示平均分
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
end
set_final_score @homework,@work
if @work.save
respond_to do |format|
format.js
@ -266,6 +267,7 @@ class StudentWorkController < ApplicationController
#添加评分的回复
def add_score_reply
@score = StudentWorksScore.find params[:score_id]
@is_last = params[:is_last] == "true"
@jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
if @jour.save
@status = 1

View File

@ -1,4 +1,5 @@
<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_index_path(:score_id => score.id)) do |f|%>
<%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
<input type="hidden" value="<%= is_last%>" name="is_last">
<a href="javascript:void(0);" class="fr blue_n_btn" onclick="$('#add_score_reply_<%= score.id%>').find('form').submit();">回复</a>
<% end%>

View File

@ -61,7 +61,7 @@
<li class="hworkList50 <%= score_color score%> student_final_scor_info">
<%= score.nil? ? "--" : format("%.1f",score)%>
<% unless score.nil?%>
<div class="info_ni">
<div class="infoNi none width180">
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。
迟交扣分

View File

@ -25,7 +25,7 @@
<div class="cl"></div>
<div id="add_score_reply_<%= score.id%>" class="undis">
<%= render :partial => 'add_score_reply',:locals => {:score => score}%>
<%= render :partial => 'add_score_reply',:locals => {:score => score,:is_last => is_last}%>
</div>
<div class="cl"></div>

View File

@ -2,39 +2,16 @@ $("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :parti
$('#score_<%= @work.id%>').peSlider({range: 'min'});
<% if @is_new%>
$("#score_list_<%= @work.id%>").prepend("<div id='work_score_<%= @score.id%>'><%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %></div>");
$("#score_list_<%= @work.id%>").find("div:last").find("ul").addClass("ping_line");
$("#score_list_<%= @work.id%>").prepend("<div id='work_score_<%= @score.id%>'><%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score,:is_last => true}) %></div>");
<% else %>
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score,:is_last => @is_last}) %>");
<% end%>
$("#score_list_<%= @work.id%>").removeAttr("style");
<% if @is_teacher %>
<% if @homework.homework_type == 1%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>");
<% elsif @homework.homework_type == 2%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>");
<% else%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
<% end%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work}) %>");
<% else %>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>");
<% end%>
$(function(){
//匿评评分提示
$(".student_score_info").bind("mouseover",function(e){
$(this).find("div").show();
});
$(".student_score_info").bind("mouseout",function(e){
$(this).find("div").hide();
});
//最终成绩提示
$(".student_final_scor_info").bind("mouseover",function(e){
$(this).find("div").show();
});
$(".student_final_scor_info").bind("mouseout",function(e){
$(this).find("div").hide();
});
});

View File

@ -1,4 +1,4 @@
$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score}) %>");
$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score,:is_last => @is_last}) %>");
<% if @status && @status == 1%>
$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
$("#add_score_reply_<%= @score.id%>").hide();

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150911064528) do
ActiveRecord::Schema.define(:version => 20150917022239) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -236,13 +236,6 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
t.boolean "tracker_in_review_dialog", :default => false
end
create_table "code_review_user_settings", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.integer "mail_notification", :default => 0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "code_reviews", :force => true do |t|
t.integer "project_id"
t.integer "change_id"
@ -476,13 +469,6 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "documents", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.integer "category_id", :default => 0, :null => false
@ -497,26 +483,23 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
create_table "dts", :primary_key => "Num", :force => true do |t|
t.string "Defect", :limit => 50
t.string "Category", :limit => 50
t.string "File"
t.string "Method"
t.string "Module", :limit => 20
t.string "Variable", :limit => 50
t.integer "StartLine"
t.integer "IPLine"
t.string "IPLineCode", :limit => 200
t.string "Judge", :limit => 15
t.integer "Review", :limit => 1
create_table "dts", :force => true do |t|
t.string "IPLineCode"
t.string "Description"
t.text "PreConditions", :limit => 2147483647
t.text "TraceInfo", :limit => 2147483647
t.text "Code", :limit => 2147483647
t.string "Num"
t.string "Variable"
t.string "TraceInfo"
t.string "Method"
t.string "File"
t.string "IPLine"
t.string "Review"
t.string "Category"
t.string "Defect"
t.string "PreConditions"
t.string "StartLine"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "enabled_modules", :force => true do |t|
@ -619,11 +602,12 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
t.text "description"
t.date "publish_time"
t.date "end_time"
t.integer "homework_type", :default => 1
t.integer "homework_type", :default => 1
t.string "late_penalty"
t.integer "course_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "teacher_priority", :default => 1
end
create_table "homework_detail_manuals", :force => true do |t|
@ -1179,18 +1163,18 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
create_table "relative_memos", :force => true do |t|
t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :limit => 16777215, :null => false
t.string "subject", :null => false
t.text "content", :null => false
t.integer "author_id"
t.integer "replies_count", :default => 0
t.integer "replies_count", :default => 0
t.integer "last_reply_id"
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"
@ -1215,19 +1199,6 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "rich_file_file_name"
t.string "rich_file_content_type"
t.integer "rich_file_file_size"
t.datetime "rich_file_updated_at"
t.string "owner_type"
t.integer "owner_id"
t.text "uri_cache"
t.string "simplified_type", :default => "file"
end
create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1
@ -1279,11 +1250,10 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
t.string "url"
t.string "title"
t.integer "share_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "project_id"
t.integer "user_id"
t.string "description"
end
create_table "softapplications", :force => true do |t|
@ -1453,8 +1423,8 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "technical_title"
t.integer "identity"
t.string "technical_title"
t.string "student_id"
t.string "teacher_realname"
t.string "student_realname"
@ -1522,6 +1492,9 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "level"
t.integer "file"
t.integer "issue"
end
create_table "user_statuses", :force => true do |t|

View File

@ -64,6 +64,7 @@ a.hworkSetting {background:url(../images/homepage_icon2.png) -10px -450px no-rep
.width625{width: 625px;}
.width455{width: 455px;}
.m_width620{max-width: 620px;}
.width180{width: 180px;}
/*邮件邀请*/