Merge branch 'educoder' into develop

dev_bj
cxt 5 years ago
commit f275cd57bf

@ -1176,7 +1176,7 @@ class CoursesController < ApplicationController
def export_course_member_excel
q = params[:name] ? "#{params[:name].strip}" : ""
filename="#{@course.teacher.show_real_name.to_s }_#{@course.name}_#{l(:excel_member_list)}";
filename="#{@course.teacher.show_real_name.to_s }_#{@course.name}_#{l(:excel_member_list)}"
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
group = CourseGroup.find params[:group_id]
unless group.nil?
@ -2437,48 +2437,48 @@ class CoursesController < ApplicationController
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
# current_col = 5
shixun_score = 0
homeworks.where(:homework_type => 4).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
homeworks.where(:homework_type => 4).each do |homework|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
if student_works.nil?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
work_score = student_works.work_score.nil? ? 0 : student_works.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
shixun_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
common_score = 0
homeworks.where(:homework_type => 1).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
homeworks.where(:homework_type => 1).each do |homework|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
if student_works.nil?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
work_score = student_works.work_score.nil? ? 0 : student_works.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
common_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
group_score = 0
homeworks.where(:homework_type => 3).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
homeworks.where(:homework_type => 3).each do |homework|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
if student_works.nil?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
work_score = student_works.work_score.nil? ? 0 : student_works.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
group_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
exercise_score = 0
exercises.includes(:exercise_users).each do |exercise|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
if exercise_user.empty?
exercises.each do |exercise|
exercise_user = exercise.score_exercise_users.find_by_user_id(member.user.id)
if exercise_user.nil?
sheet1[count_row,column+=1] = 0
else
work_score = exercise_user.first.score.nil? ? 0 : exercise_user.first.score
work_score = exercise_user.score.nil? ? 0 : exercise_user.score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
exercise_score += work_score < 0 ? 0 : work_score.round(1)
end
@ -2486,7 +2486,7 @@ class CoursesController < ApplicationController
end
graduation_score = 0
tasks.includes(:graduation_works).each do |task|
tasks.each do |task|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
if graduation_works.empty?
sheet1[count_row,column+=1] = 0
@ -2576,7 +2576,7 @@ class CoursesController < ApplicationController
sheet[3,1] = "#{i+1}"
sheet[3,0] = "作业名称"
sheet[3,1] = home.name
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),"分班",l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
count_row = 5
items = home.score_student_works
# if items.count == 0 && home.publish_time < Time.now && !course.is_end
@ -2588,10 +2588,11 @@ class CoursesController < ApplicationController
sheet[count_row,1] = stu.user.show_real_name
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.late_penalty
sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,7] = format_time(stu.commit_time)
sheet[count_row,4] = member_group_name course.members, stu.user_id
sheet[count_row,5] = strip_html stu.description
sheet[count_row,6] = stu.late_penalty
sheet[count_row,7] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,8] = format_time(stu.commit_time)
count_row += 1
end
end

@ -7,7 +7,7 @@ class Exercise < ActiveRecord::Base
has_many :exercise_group_settings, :dependent => :destroy
has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number"
has_many :exercise_users, :dependent => :destroy, :conditions => "exercise_users.is_delete = 0"
has_many :score_exercise_users, :conditions => "exercise_users.is_delete = 0 and commit_status != 0", :order => "exercise_users.score desc"
has_many :score_exercise_users, :class_name => "ExerciseUser", :conditions => "exercise_users.is_delete = 0 and commit_status != 0", :order => "exercise_users.score desc"
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# 课程消息

@ -5,7 +5,9 @@
<tr class="eduCenternew">
<th width="10%" class="tabeltext-alignleft">用户ID</th>
<th width="10%" class="tabeltext-alignleft">姓名</th>
<th width="10%" class="tabeltext-alignleft">学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th width="10%" class="tabeltext-alignleft">学号</th>
<% end %>
<th width="10%" class="tabeltext-alignleft">分班</th>
<!--<th width="13%" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis" class="tabeltext-alignleft">课堂成绩</th>
<th width="10%">活跃度</th>-->
@ -22,9 +24,11 @@
<% end %>
<span class="edu-txt-w140 task-hide mt5"><%= user.login %></span></td>
<td class="tabeltext-alignleft"><%= link_to user.show_real_name, user_path(user), :class => 'edu-txt-w140 task-hide mt5 color-grey-3', :target => '_blank' %></td>
<td class="tabeltext-alignleft">
<span class="edu-txt-w140 task-hide mt5"><%= user.user_extensions ? user.user_extensions.student_id : '' %></span>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<td class="tabeltext-alignleft">
<span class="edu-txt-w140 task-hide mt5"><%= user.user_extensions ? user.user_extensions.student_id : '' %></span>
</td>
<% end %>
<td class="tabeltext-alignleft"><%= member.course_group_id == 0 || member.course_group_id.nil? ? '未分班' : member.course_group.name %></td>
<% if false %>
<td class="tabeltext-alignleft"><%= format("%.1f", member.course_score) %></td><!--课堂成绩-->

@ -12,7 +12,9 @@
<th>序号</th>
<th>姓名</th>
<th class="with10">分班</th>
<th>学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>提交状态</th>
<th>提交时间</th>
<th>客观题得分</th>
@ -35,9 +37,11 @@
<td title="<%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %></span>
</td>
<td title="<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<td title="<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>
</td>
<% end %>
<td>
<%= (ex_poll_work_status exercise.commit_status).html_safe %>
</td>

@ -16,27 +16,29 @@
</div>
</div>
<div class="clearfix minH-280">
<table cellpadding="0" cellspacing="0" class="edu-txt-center edu-pop-table aroundRange">
<table class="edu-pop-table edu-txt-center hover-td" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="4%">序号</th>
<th>序号</th>
<th width="10%">姓名</th>
<th class="flex1">学号</th>
<th width="7%">分班</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>分班</th>
<% if @task.task_type == 2 %>
<th width="7%">分组</th>
<th>分组</th>
<% if @task.base_on_project %>
<th width="12%">关联项目</th>
<th>关联项目</th>
<% end %>
<% end %>
<th width="6%">提交状态</th>
<th width="12%">更新时间</th>
<th width="8%">教师评分</th>
<th>提交状态</th>
<th>更新时间</th>
<th>教师评分</th>
<% if @task.cross_comment %>
<th width="8%">交叉评分</th>
<th>交叉评分</th>
<% end %>
<th width="8%">最终成绩</th>
<th width="11%">操作</th>
<th>最终成绩</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@ -44,16 +46,20 @@
<% @works.each_with_index do |work, i| %>
<% score_open = task_score_open || work.user == User.current %>
<tr>
<td width="4%"><%= (@page - 1) * @limit + i + 1 %></td>
<td width="10%"><%= link_to work.user.show_real_name, user_path(work.user), :target => "_blank" %></td>
<% student_id = work.user.user_extensions.nil? ? "--" : work.user.user_extensions.student_id %>
<td class="task-hide flex1"><%= student_id %></td>
<td><%= (@page - 1) * @limit + i + 1 %></td>
<td><%= link_to work.user.show_real_name, user_path(work.user), :target => "_blank" %></td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<% student_id = work.user.user_extensions.nil? ? "--" : work.user.user_extensions.student_id %>
<td class="task-hide"><%= student_id %></td>
<% end %>
<% group_name = member_group_name @course.members, work.user_id %>
<td width="7%" class="task-hide" title="<%= group_name %>"><%= group_name %></td>
<td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td>
<% if @task.task_type == 2 %>
<td width="7%" class="task-hide"><%= work.group_id == 0 ? '--' : '分组'+work.group_id.to_s %></td>
<td class="task-hide"><%= work.group_id == 0 ? '--' : '分组'+work.group_id.to_s %></td>
<% if @task.base_on_project %>
<td width="12%" class="student_score_info edu-position">
<td class="student_score_info edu-position">
<% if work.project %>
<% project = work.project %>
<% if project.status != 9 && (project.is_public || User.current.member_of?(project) || @is_teacher) %>
@ -85,18 +91,18 @@
</td>
<% end %>
<% end %>
<td width="6%"><%= (ex_poll_work_status work.work_status).html_safe %></td>
<td width="12%" class="color-grey-9"><%= work.work_status == 0 ? '--' : format_time(work.update_time) %></td>
<td width="8%" class="<%= score_color (!score_open || work.teacher_score.nil? ? nil : work.teacher_score)%>">
<td><%= (ex_poll_work_status work.work_status).html_safe %></td>
<td class="color-grey-9"><%= work.work_status == 0 ? '--' : format_time(work.update_time) %></td>
<td class="<%= score_color (!score_open || work.teacher_score.nil? ? nil : work.teacher_score)%>">
<%= work.work_status == 0 ? '--' : (work.teacher_score.nil? ? "未批阅" : (!score_open ? "**" : format("%.1f", work.teacher_score.round(1)))) %>
</td>
<% if @task.cross_comment %>
<td width="8%" class="<%= score_color (!score_open || work.cross_score.nil? ? nil : work.cross_score)%>">
<td class="<%= score_color (!score_open || work.cross_score.nil? ? nil : work.cross_score)%>">
<%= work.work_status == 0 ? '--' : (work.cross_score.nil? ? "未批阅" : (!score_open ? "**" : (format("%.1f", work.cross_score.round(1)) + "#{work.graduation_work_scores.where(:reviewer_role => 2).group_by(&:user_id).count}"))) %>
</td>
<% end %>
<% score = work.work_score %>
<td width="8%" class="<%= score_color (!score_open || score.nil? ? nil : score)%> edu-position">
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%> edu-position">
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score.round(1)))%>
<% if score.present? %>
<div class="popup_tip_box-black" style="left: 65px;">
@ -110,7 +116,7 @@
</div>
<% end %>
</td>
<td width="11%">
<td>
<% if @is_teacher && @task.cross_comment && @task.comment_status == 2 %>
<a href="<%= assign_teacher_graduation_work_path(work) %>" data-remote="true" class="color-blue ml5 mr5 allotTeacher">分配</a>
<% end %>

@ -3,7 +3,9 @@
<p>
<span>序号</span>
<span class="s-w">姓名</span>
<span class="m-w">学号</span>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<span class="m-w">学号</span>
<% end %>
<span class="m-w">分班</span>
<span class="m-w">选题时间</span>
<span class="l-w flex1">确认结果</span>
@ -15,8 +17,10 @@
<p>
<span class="color-grey-6"><%= index + 1 %></span>
<span class="s-w color-grey-3"><a href="<%= user_path(student_topic.user) %>" target="_blank"><%= student_topic.user.show_real_name %></a></span>
<% student_id = student_topic.user.user_extensions.try(:student_id).present? ? student_topic.user.user_extensions.student_id : "--" %>
<span class="m-w"><%= student_id %></span>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<% student_id = student_topic.user.user_extensions.try(:student_id).present? ? student_topic.user.user_extensions.student_id : "--" %>
<span class="m-w"><%= student_id %></span>
<% end %>
<span class="m-w"><%= student_topic.member.course_group.try(:name) %></span>
<span class="m-w"><%= format_time student_topic.created_at %></span>
<%= (student_topic_status student_topic.status).html_safe %>

@ -10,7 +10,9 @@
<th>序号</th>
<th>姓名</th>
<th class="with20">分班</th>
<th>学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>提交状态</th>
<th>提交时间</th>
<% if @poll.un_anonymous && @is_teacher %>
@ -29,9 +31,11 @@
<td title="<%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %>">
<span class="task-hide" style="display: block;max-width: 230px;"><%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %></span>
</td>
<td title="<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>">
<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<td title="<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>">
<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>
</td>
<% end %>
<td>
<%= (ex_poll_work_status poll.commit_status).html_safe %>
</td>

@ -3,7 +3,9 @@
<th>序号</th>
<th>姓名</th>
<th class="with10">分班</th>
<th>学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>提交状态</th>
<th>更新时间</th>
<th>教师评分</th>
@ -33,10 +35,12 @@
<td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td>
<% student_id = student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
<td title="<%= student_id %>">
<%= student_id %>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<% student_id = student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
<td title="<%= student_id %>">
<%= student_id %>
</td>
<% end %>
<td>
<%= (ex_poll_work_status student_work.work_status).html_safe %>
</td>

@ -3,7 +3,9 @@
<th>序号</th>
<th>姓名</th>
<th class="with10">分班</th>
<th>学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>分组</th>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<th>关联项目</th>
@ -38,10 +40,12 @@
<td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td>
<% student_id = student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
<td title="<%= student_id %>">
<%= student_id %>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<% student_id = student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
<td title="<%= student_id %>">
<%= student_id %>
</td>
<% end %>
<td>
<%= student_work.group_id == 0 ? '--' : '分组'+student_work.group_id.to_s %>
</td>

@ -3,7 +3,9 @@
<th>序号</th>
<th class="with10">姓名</th>
<th>分班</th>
<th>学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>提交状态</th>
<th>提交耗时</th>
<th>更新时间</th>
@ -30,10 +32,12 @@
<td title="<%= group_name %>">
<span class="task-hide"><%= group_name %></span>
</td>
<% student_id = student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
<td title="<%= student_id %>">
<%= student_id %>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<% student_id = student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
<td title="<%= student_id %>">
<%= student_id %>
</td>
<% end %>
<td>
<% status = list_work_status student_work, @homework, group_id %>
<span class='<%= status == "未提交" ? "" : ((status == "按时提交" || status == "正在提交") ? "color-light-green" : "color-red") %>'><%= status %></span>

Loading…
Cancel
Save