Merge branch 'szzh' into dev_hjq

This commit is contained in:
huang 2015-06-19 15:48:04 +08:00
commit a05b8d1f39
15 changed files with 94 additions and 48 deletions

View File

@ -695,7 +695,6 @@ class CoursesController < ApplicationController
# 显示老师和助教的活动 # 显示老师和助教的活动
# @authors = searchTeacherAndAssistant(@course) # @authors = searchTeacherAndAssistant(@course)
@authors = course_all_member(@course) @authors = course_all_member(@course)
Dir.glob("#{Rails.root}/app/models/*.rb").sort.each { |file| require file }
events = [] events = []
key = "course_events_#{@course.id}".to_sym key = "course_events_#{@course.id}".to_sym
if Rails.env.production? && Setting.course_cahce_enabled? if Rails.env.production? && Setting.course_cahce_enabled?

View File

@ -157,7 +157,7 @@ class MemosController < ApplicationController
def update def update
respond_to do |format| respond_to do |format|
if( @memo.update_column(:subject, params[:memo][:subject]) && if( #@memo.update_column(:subject, params[:memo][:subject]) &&
@memo.update_column(:content, params[:memo][:content]) && @memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky]) && @memo.update_column(:sticky, params[:memo][:sticky]) &&
@memo.update_column(:lock, params[:memo][:lock])) @memo.update_column(:lock, params[:memo][:lock]))

View File

@ -227,7 +227,7 @@ update
elsif request.get? elsif request.get?
respond_to do |format| respond_to do |format|
format.html{ format.html{
render :layout => "project_base" render :layout => "base_projects"
} }
end end
@ -376,7 +376,7 @@ update
def revision def revision
respond_to do |format| respond_to do |format|
format.html{render :layout => 'project_base'} format.html{render :layout => 'base_projects'}
format.js {render :layout => false} format.js {render :layout => false}
end end
end end

View File

@ -14,13 +14,21 @@ class StudentWorkController < ApplicationController
@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
if @show_all if @show_all
if @homework.homework_type == 1 || @is_teacher || User.current.admin? if @homework.homework_type == 1 || @is_teacher || User.current.admin?
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name if @order == "name"
@stundet_works = search_homework_member @homework.student_works.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
end
else else
my_work = @homework.student_works.where(:user_id => User.current.id) my_work = @homework.student_works.where(:user_id => User.current.id)
if my_work.empty? if my_work.empty?
@stundet_works = [] @stundet_works = []
else else
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name if @order == "name"
@stundet_works = search_homework_member @homework.student_works.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
end
end end
end end
else #学生 else #学生
@ -243,7 +251,7 @@ class StudentWorkController < ApplicationController
(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_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 (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` FROM `student_works`
WHERE homework_common_id = 213 WHERE homework_common_id = #{@homework.id}
) AS table_1 ) AS table_1
ORDER BY absence #{order}") ORDER BY absence #{order}")
@order = order == "desc" ? "asc" : "desc" @order = order == "desc" ? "asc" : "desc"

View File

@ -70,4 +70,14 @@ module StudentWorkHelper
def has_evaluation_count user,homework def has_evaluation_count user,homework
StudentWorksScore.joins(:student_work).where("student_works_scores.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count StudentWorksScore.joins(:student_work).where("student_works_scores.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count
end end
#传入分数,获取对应颜色
def score_color score
if score
color = score >= 90 ? "c_red" : "c_green"
else
color = "c_grey"
end
color
end
end end

View File

@ -21,9 +21,9 @@
<div class="actions"> <div class="actions">
<p> <p>
<% if @memo.parent.nil? && @memo.children.first.nil? %> <% if @memo.parent.nil? && @memo.children.first.nil? %>
<%= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%> <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%>
<% else %> <% else %>
<%= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%> <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%>
<% end %> <% end %>
</p> </p>
<% if User.current.admin?%> <% if User.current.admin?%>

View File

@ -33,8 +33,7 @@
<td><a href="javascript:viod(0)" class="c_blue" > <td><a href="javascript:viod(0)" class="c_blue" >
<% if repository.scm_name=="Git"%> <% if repository.scm_name=="Git"%>
<%if User.current.allowed_to?(:manage_repository, @project) %> <%if User.current.allowed_to?(:manage_repository, @project) %>
<%= link_to(l(:label_user_plural), committers_repository_path(repository) <%= link_to(l(:label_user_plural), committers_repository_path(repository)) %>
) %>
<% end %> <% end %>
<% end %> <% end %>
</a></td> </a></td>

View File

@ -27,25 +27,15 @@
<% end %> <% end %>
<td class="buttons" style="text-align:left"> <td class="buttons" style="text-align:left">
<% if repository.scm_name=="Subversion"%>
<%if User.current.allowed_to?(:manage_repository, @project) %> <%if User.current.allowed_to?(:manage_repository, @project) %>
<%= link_to(l(:label_user_plural), committers_repository_path(repository), <!-- <%#= link_to(l(:button_edit), edit_repository_path(repository),
:class => 'icon icon-user') %>
<%= link_to(l(:button_edit), edit_repository_path(repository),
:class => 'icon icon-edit') %>
<%= delete_link repository_path(repository) %>
<% end %>
<% elsif repository.scm_name=="Git"%>
<%if User.current.allowed_to?(:manage_repository, @project) %>
<!-- <%#= link_to(l(:button_edit), edit_repository_path(repository),
:class => 'icon icon-edit') %> --> :class => 'icon icon-edit') %> -->
<%= link_to(l(:label_user_plural), committers_repository_path(repository), <%= link_to(l(:label_user_plural), committers_repository_path(repository), :class => 'icon icon-user') %>
:class => 'icon icon-user') %> <% if repository.login.to_s==User.current.login.to_s %>
<% if repository.login.to_s==User.current.login.to_s %> <%= delete_link repository_path(repository) %>
<%= delete_link repository_path(repository) %> <% end %>
<% end %> <% end %>
<% end %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@ -11,28 +11,35 @@
<li class=" hwork_tit"> <li class=" hwork_tit">
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%> <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
</li> </li>
<li class=" hwork_code <%= student_work.teacher_score.nil? ? 'c_grey' : 'c_red'%> mr18"> <li class=" hwork_time_c">
<%= student_work.teacher_score.nil? ? "--" : format("%.2f",student_work.teacher_score)%> <% if Time.parse(@homework.end_time.to_s) < Time.parse(student_work.created_at.to_s) %>
<span class="c_red">迟交</span>
<% else%>
<%= student_work.created_at.strftime("%m-%d").to_s%>
<% end %>
</li> </li>
<li class=" hwork_code <%= student_work.teaching_asistant_score.nil? ? 'c_grey' : 'c_red'%> mr18"> <li class=" hwork_score <%= score_color student_work.teacher_score%>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.2f",student_work.teaching_asistant_score)%> <%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
</li> </li>
<li class=" hwork_code02 <%= student_work.student_score.nil? ? 'c_grey' : 'c_red'%> mr18 student_score_info" > <li class=" hwork_score <%= score_color student_work.teaching_asistant_score%>">
<%= student_work.student_score.nil? ? "--" : format("%.2f",student_work.student_score)%> <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
</li>
<li class=" hwork_code02 <%= score_color student_work.student_score%> student_score_info" >
<%= student_work.student_score.nil? ? "--" : format("%.1f",student_work.student_score)%>
<% unless student_work.student_score.nil?%> <% unless student_work.student_score.nil?%>
<span class="c_blue"> <span class="">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>) (<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
</span> </span>
<div class="info_ni"> <div class="info_ni">
现共有 现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>&nbsp;</span> <span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>&nbsp;</span>
名学生进行了匿评,平均分为 名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.2f",student_work.student_score)%>&nbsp;</span>分。 <span class="c_red">&nbsp;<%= format("%.1f",student_work.student_score)%>&nbsp;</span>分。
</div> </div>
<% end%> <% end%>
</li> </li>
<li class=" hwork_code <%= student_work.final_score.nil? ? 'c_grey' : 'c_red'%>"> <li class=" hwork_score <%= score_color student_work.final_score%>">
<%= student_work.final_score.nil? ? "--" : format("%.2f",student_work.final_score)%> <%= student_work.final_score.nil? ? "--" : format("%.1f",student_work.final_score)%>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
</ul><!---hwork_ul end--> </ul><!---hwork_ul end-->

View File

@ -2,30 +2,39 @@
<span class="c_dark f14 fb fl">学号</span> <span class="c_dark f14 fb fl">学号</span>
</li> </li>
<li class=" hwork_name f14 fb c_dark"> <li class=" hwork_name f14 fb c_dark">
学生姓名 <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "name"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li> </li>
<li class="hwork_tit"> <li class="hwork_tit">
<span class="c_dark f14 fb fl">作品名称</span> <span class="c_dark f14 fb fl">作品名称</span>
</li> </li>
<li class="mr5 w70"> <li class=" hwork_time f14 fb c_dark">
<%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl hwork_code"%> <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "created_at"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<li class="mr5 w40 ml15">
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "teacher_score"%> <% if @show_all && @order == "teacher_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a> <a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%> <% end%>
</li> </li>
<li class="mr5 w70"> <li class="mr5 w40 ml20">
<%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl hwork_code"%> <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "teaching_asistant_score"%> <% if @show_all && @order == "teaching_asistant_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a> <a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%> <% end%>
</li> </li>
<li class="mr5 ml15 w40"> <li class="mr5 ml10 w40">
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "student_score"%> <% if @show_all && @order == "student_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a> <a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%> <% end%>
</li> </li>
<li class="ml30"> <li class="ml20">
<%= 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"%> <%= 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"%> <% if @show_all && @order == "final_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a> <a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>

View File

@ -0,0 +1,19 @@
class HomeworkCommonTime < ActiveRecord::Migration
def up
count = StudentWork.all.count / 100 + 1
transaction do
for i in 1 ... count do i
StudentWork.page(i).per(100).each do |homework|
old_homework = HomeworkAttach.where(:user_id => homework.user_id, :name => homework.name, :description => homework.description).first
if old_homework
homework.update_column('created_at', old_homework.created_at)
end
end
end
puts i.to_s
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150604153000) do ActiveRecord::Schema.define(:version => 20150619060110) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false

View File

@ -6,6 +6,7 @@ module Trustie
def self.included(base) def self.included(base)
base.class_eval{ base.class_eval{
after_create :clear_course_events after_create :clear_course_events
after_destroy :clear_course_events
} }
end end

View File

@ -100,7 +100,6 @@ a:hover.grey_btn{ background:#717171; color:#fff;}
.f_14{ font-size:14px;} .f_14{ font-size:14px;}
.c_dblue{ color:#3e6d8e;} .c_dblue{ color:#3e6d8e;}
.w90{width:90px;} .w90{width:90px;}
.w40{width:40px;}
.ml10{margin-left:10px;} .ml10{margin-left:10px;}
.resource{ width:670px;} .resource{ width:670px;}
.re_top{width:660px; height:40px; background:#eaeaea; padding:5px;} .re_top{width:660px; height:40px; background:#eaeaea; padding:5px;}
@ -661,6 +660,9 @@ a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.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;} .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;} .hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
.hwork_name_ab{ display:block;width:340px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;} .hwork_name_ab{ display:block;width:340px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
.hwork_time{ display:block;width:40px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
.hwork_time_c{width:40px;color: #6d6d6d}
.hwork_score{ width:62px; text-align:center; }
.absence{width: 50px;text-align: center;} .absence{width: 50px;text-align: center;}
/* 评分插件 */ /* 评分插件 */
input#score{ width:40px;} input#score{ width:40px;}

View File

@ -58,6 +58,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml8{ margin-left:8px;} .ml8{ margin-left:8px;}
.ml10{ margin-left:10px;} .ml10{ margin-left:10px;}
.ml15{ margin-left:15px;} .ml15{ margin-left:15px;}
.ml16{ margin-left: 16px;}
.ml20{ margin-left:20px;} .ml20{ margin-left:20px;}
.ml35{margin-left: 35px;} .ml35{margin-left: 35px;}
.ml40{ margin-left:40px;} .ml40{ margin-left:40px;}
@ -90,6 +91,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.w20{ width:20px;} .w20{ width:20px;}
.w40{width: 40px;} .w40{width: 40px;}
.w45{ width: 45px;} .w45{ width: 45px;}
.w50{ width:50px;}
.w60{ width:60px;} .w60{ width:60px;}
.w70{ width:70px;} .w70{ width:70px;}
.w90{ width:90px;} .w90{ width:90px;}