Merge branch 'cxt_course' into develop

Conflicts:
	app/views/users/_course_message.html.erb
This commit is contained in:
huang 2016-05-03 17:12:38 +08:00
commit a602a6aa63
34 changed files with 239 additions and 40 deletions

View File

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

View File

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

View File

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

View File

@ -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
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
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,8 +124,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
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? #教辅未评分
@ -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
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

View File

@ -97,11 +97,19 @@
</div>
<div class="cl"></div>
<div class="homepagePostReply">
<% unless @comments.empty? %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=@comments.count %></div>
<div class="homepagePostReplyBannerTime"></div>
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= @comments.count>0 ? "#{@comments.count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@news.id %>">
<% if @news.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@news) > 0 ? "#{get_praise_num(@news)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%>
<% end %>
</span>
</div>
</div>
<% unless @comments.empty? %>
<div class="" id="reply_div_<%=@news.id %>">
<% @comments.each_with_index do |reply,i| %>
<script type="text/javascript">
@ -127,13 +135,20 @@
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr newsGrey" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
<% end %>
</span>
<%= link_to_if_authorized_course(
l(:button_delete),
{:controller => 'comments',
:action => 'destroy', :id => @news,
:comment_id => reply},
:method => :delete,
:class => 'fr newsGrey',
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) %>

View File

@ -35,3 +35,8 @@
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -211,7 +211,7 @@
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now time %>
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>
</div>
</div>
<% 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();
});
</script>

View File

@ -157,3 +157,8 @@
<% end %>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -121,3 +121,8 @@
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -56,3 +56,8 @@
</div>
</div>
<% end %>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -139,3 +139,8 @@
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -159,3 +159,8 @@
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -143,4 +143,7 @@
</div>
<script type="text/javascript">
$(description_show_hide(<%=user_activity_id %>));
$(function(){
user_card_show_hide();
});
</script>

View File

@ -37,3 +37,8 @@
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -133,3 +133,8 @@
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -152,4 +152,7 @@
target.eq(2).show();
}
}
$(function(){
user_card_show_hide();
});
</script>

View File

@ -37,3 +37,8 @@
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -121,3 +121,8 @@
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -39,3 +39,8 @@
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -35,3 +35,8 @@
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -226,7 +226,7 @@
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now time %>
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>
</div>
</div>
<% 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();
});
</script>

View File

@ -107,4 +107,9 @@
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -175,3 +175,8 @@
<% end %>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -146,3 +146,8 @@
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -55,3 +55,8 @@
</div>
</div>
<% end %>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -39,3 +39,8 @@
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -37,3 +37,8 @@
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -96,3 +96,8 @@
<%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -167,3 +167,8 @@
<% end %>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -144,4 +144,7 @@
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#moreProject_<%=user_activity_id %>").show();
});
$(function(){
user_card_show_hide();
});
</script>

View File

@ -230,7 +230,7 @@
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now time %>
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>
</div>
</div>
<% 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();
});
</script>

View File

@ -150,3 +150,8 @@
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -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}) %>');

View File

@ -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++){