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/student_work_controller.rb b/app/controllers/student_work_controller.rb index e7c10f9eb..95117e6a8 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -791,7 +791,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 @@ -1174,8 +1174,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 +1193,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 +1233,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 +1268,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 63656ba5e..ee2a8ca91 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? 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/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 3236aa6a0..ee9d63720 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -97,11 +97,19 @@
+
+
回复 + <%= @comments.count>0 ? "(#{@comments.count})" : "" %> + + <% if @news.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%> + <% end %> + +
+
<% unless @comments.empty? %> -
-
回复(<%=@comments.count %>)
-
-
<% @comments.each_with_index do |reply,i| %> \ 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..4ffaa93fb 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -211,7 +211,7 @@
项目名称:<%=project.name %>
创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now time %> + 更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>
<% if i == 9 && projects.count > 10 %> @@ -372,4 +372,7 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); + $(function(){ + user_card_show_hide(); + }); \ No newline at end of file diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index 9a9943e9b..56dafed08 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -157,3 +157,8 @@ <% end %>
+ diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index 7f50b3725..a6183e891 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -121,3 +121,8 @@ + diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb index 10d1919a2..cb390f7f5 100644 --- a/app/views/organizations/_org_course_poll.html.erb +++ b/app/views/organizations/_org_course_poll.html.erb @@ -56,3 +56,8 @@ <% end %> + diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 9b7dbfa8f..98c1e2df3 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -139,3 +139,8 @@ + diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index bf0cc8734..fc6cc6ee0 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -159,3 +159,8 @@ + diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb index 3d2a316cf..daa81e96c 100644 --- a/app/views/organizations/_org_subfield_news.html.erb +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -143,4 +143,7 @@ diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index 5003fd0e2..ef59d154e 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -36,4 +36,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index a818939d6..26cf3b318 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -133,3 +133,8 @@ + diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index fdd6772e7..6012dd0d4 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -152,4 +152,7 @@ target.eq(2).show(); } } + $(function(){ + user_card_show_hide(); + }); \ No newline at end of file diff --git a/app/views/projects/_project_create.html.erb b/app/views/projects/_project_create.html.erb index ef0c7c4c3..bd118418d 100644 --- a/app/views/projects/_project_create.html.erb +++ b/app/views/projects/_project_create.html.erb @@ -36,4 +36,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 4ea0e9f17..8756ff26f 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -120,4 +120,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/users/_course_attachment.html.erb b/app/views/users/_course_attachment.html.erb index 6f6cf82f3..63c57f708 100644 --- a/app/views/users/_course_attachment.html.erb +++ b/app/views/users/_course_attachment.html.erb @@ -38,4 +38,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/users/_course_create.html.erb b/app/views/users/_course_create.html.erb index dc1e0ee81..6b2234337 100644 --- a/app/views/users/_course_create.html.erb +++ b/app/views/users/_course_create.html.erb @@ -34,4 +34,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 743090a4d..7afc65cc3 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -226,7 +226,7 @@
项目名称:<%=project.name %>
创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now time %> + 更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>
<% if i == 9 && projects.count > 10 %> @@ -388,4 +388,7 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); + $(function(){ + user_card_show_hide(); + }); diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index f9a59f024..1d0c4cba5 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -107,4 +107,9 @@ + diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 56133d1de..356a152a6 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -174,4 +174,9 @@ <% end %> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index efaa72beb..403a922ed 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -146,3 +146,8 @@ + diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index 970fb516e..dab970cdf 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -55,3 +55,8 @@ <% end %> + diff --git a/app/views/users/_project_attachment.html.erb b/app/views/users/_project_attachment.html.erb index b3d904104..795432008 100644 --- a/app/views/users/_project_attachment.html.erb +++ b/app/views/users/_project_attachment.html.erb @@ -38,4 +38,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/users/_project_create.html.erb b/app/views/users/_project_create.html.erb index 0e35bca25..83bfe3f04 100644 --- a/app/views/users/_project_create.html.erb +++ b/app/views/users/_project_create.html.erb @@ -36,4 +36,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 008f08706..daa7c71c2 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -96,3 +96,8 @@ <%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %> + \ No newline at end of file diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index c071f4a13..0a41dbbf5 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -167,3 +167,8 @@ <% end %> + diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 841fd9377..74f090344 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -144,4 +144,7 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); + $(function(){ + user_card_show_hide(); + }); diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 43bde1779..0183627d4 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -230,7 +230,7 @@
项目名称:<%=project.name %>
创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now time %> + 更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>
<% if i == 9 && projects.count > 10 %> @@ -392,4 +392,7 @@ $("#relatePWrap_<%=homework_common.id %>").toggleClass('relatePWrap'); $("#moreProject_<%=homework_common.id %>").show(); }); + $(function(){ + user_card_show_hide(); + }); \ No newline at end of file diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index dde4f34ce..944477e88 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -149,4 +149,9 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/users/choose_user_course.js.erb b/app/views/users/choose_user_course.js.erb index 77c8d2522..51af05782 100644 --- a/app/views/users/choose_user_course.js.erb +++ b/app/views/users/choose_user_course.js.erb @@ -2,6 +2,8 @@ alert("您的申请尚未通过审核,暂时不可发送至课程"); <% elsif @status == 2 %> alert("该作业是私有的,请先提交申请并通过审核后再发送"); +<% elsif @status == 3 %> + alert("您的申请已被拒绝,不可发送至课程"); <% else %> <% if params[:is_observe].nil? %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>'); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 7c52bae35..f2b89142d 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -23,6 +23,31 @@ function description_show_hide(id){ }); } +//名片的显示 +function user_card_show_hide() { + $(".homepagePostPortrait").mouseover(function(){ + onImage = true; + $(this).children(".userCard").css("display","block"); + }); + $(".homepagePostPortrait").mouseout(function(){ + var cur = $(this); + onImage = false; + setTimeout(function(){ + if (onUserCard == false && onImage == false){ + $(cur).children(".userCard").css("display", "none"); + } + }, 500); + }); + $(".userCard").mouseover(function(){ + onUserCard = true; + $(this).css("display","block"); + }); + $(".userCard").mouseout(function(){ + onUserCard = false; + $(this).css("display","none"); + }); +} + function cleanArray (actual){ var newArray = new Array(); for (var i = 0; i< actual.length; i++){