Conflicts: app/controllers/homework_common_controller.rbsw_new_course
commit
5e90684677
@ -0,0 +1,46 @@
|
||||
module Mobile
|
||||
module Entities
|
||||
class Message < Grape::Entity
|
||||
include ApplicationHelper
|
||||
include ApiHelper
|
||||
def self.message_expose(f)
|
||||
expose f do |u,opt|
|
||||
if u.is_a?(Hash) && u.key?(f)
|
||||
u[f]
|
||||
elsif u.is_a?(::Message)
|
||||
if u.respond_to?(f)
|
||||
if f == :created_on
|
||||
format_time( u.send(f))
|
||||
else
|
||||
u.send(f)
|
||||
end
|
||||
else
|
||||
# case f
|
||||
# when :xx
|
||||
# #
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
expose :user, using: Mobile::Entities::User do |c, opt|
|
||||
if c.is_a?(::Message)
|
||||
c.author
|
||||
end
|
||||
end
|
||||
message_expose :board_id
|
||||
message_expose :subject
|
||||
message_expose :content
|
||||
message_expose :replies_count
|
||||
message_expose :created_on
|
||||
message_expose :id
|
||||
expose :message_children,using:Mobile::Entities::Message do |c,opt|
|
||||
if c.is_a? (::Message)
|
||||
c.children
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,45 @@
|
||||
module Mobile
|
||||
module Entities
|
||||
class StudentWork < Grape::Entity
|
||||
include ApplicationHelper
|
||||
include ApiHelper
|
||||
def self.student_work_expose(f)
|
||||
expose f do |u,opt|
|
||||
if u.is_a?(Hash) && u.key?(f)
|
||||
u[f]
|
||||
elsif u.is_a?(::StudentWork)
|
||||
if u.respond_to?(f)
|
||||
if f == :created_at
|
||||
format_time(u.send(:created_at))
|
||||
else
|
||||
u.send(f)
|
||||
end
|
||||
|
||||
else
|
||||
case f
|
||||
when :student_id
|
||||
u.user.user_extensions.student_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
expose :user, using: Mobile::Entities::User do |c, opt|
|
||||
if c.is_a?(::StudentWork)
|
||||
c.user
|
||||
end
|
||||
end
|
||||
student_work_expose :student_id
|
||||
student_work_expose :id
|
||||
student_work_expose :name
|
||||
student_work_expose :description
|
||||
student_work_expose :final_score
|
||||
student_work_expose :teacher_score
|
||||
student_work_expose :student_score
|
||||
student_work_expose :teacher_asistant_score
|
||||
student_work_expose :created_at
|
||||
end
|
||||
end
|
||||
end
|
@ -1,149 +1,149 @@
|
||||
module HomeworkAttachHelper
|
||||
#判断是否具有删除的权限
|
||||
def attach_delete(project)
|
||||
if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
#作业添加、编辑界面的tab页
|
||||
def homework_settings_tabs f
|
||||
@f = f
|
||||
tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
||||
{:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
||||
]
|
||||
end
|
||||
|
||||
#作业可选成员列表分页
|
||||
def render_new_members_for_homework members
|
||||
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
||||
#scope = project.members
|
||||
#principals = paginateHelper members,10
|
||||
#principals = members
|
||||
#principal_count = members.count
|
||||
#limit = 10
|
||||
#principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||
#offset ||= principal_pages.offset
|
||||
#principals = members[offset, limit]
|
||||
users = members.map(&:user)
|
||||
s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', users), :id => 'principals')
|
||||
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||
link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@homework)), :remote => true }
|
||||
return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
||||
end
|
||||
|
||||
#扩展的checkbox生成
|
||||
def member_check_box_tags_ex(name, principals)
|
||||
s = ''
|
||||
principals.each do |member|
|
||||
s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.name }</label><br/>"
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
||||
def paginateHelper obj, pre_size=20
|
||||
@obj_count = obj.count
|
||||
@obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
|
||||
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
|
||||
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
|
||||
elsif obj.kind_of? Array
|
||||
obj[@obj_pages.offset, @obj_pages.per_page]
|
||||
else
|
||||
logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
|
||||
raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||
end
|
||||
end
|
||||
|
||||
def user_projects_option
|
||||
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||
memberships = User.current.memberships.all(:conditions => cond)
|
||||
projects = memberships.map(&:project)
|
||||
not_have_project = []
|
||||
not_have_project << Setting.please_chose
|
||||
not_have_project << 0
|
||||
type = []
|
||||
type << not_have_project
|
||||
projects.each do |project|
|
||||
if project != nil
|
||||
option = []
|
||||
option << project.name
|
||||
option << project.id
|
||||
type << option
|
||||
end
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#判断指定用户是不是已经赞过该作业
|
||||
def is_praise_homework user_id, obj_id
|
||||
PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").empty?
|
||||
end
|
||||
|
||||
#获取赞的总数
|
||||
def praise_homework_count obj_id
|
||||
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
|
||||
end
|
||||
|
||||
#获取用户对作业的评分
|
||||
def get_homework_score user, homework
|
||||
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
|
||||
@m_score = temp.nil? ? 0:temp.stars.to_i
|
||||
end
|
||||
|
||||
#获取评分对应的评论
|
||||
def get_homework_review homework,is_teacher,user
|
||||
homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
|
||||
end
|
||||
|
||||
def convert_array array
|
||||
ary = "("
|
||||
if array.nil? || array.count == 0
|
||||
return "()"
|
||||
end
|
||||
array.length.times do |i|
|
||||
if i == array.length - 1
|
||||
ary += array[i].id.to_s + ")"
|
||||
else
|
||||
if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "")
|
||||
ary += array[i].id.to_s + ","
|
||||
end
|
||||
end
|
||||
end
|
||||
#array.each do |member|
|
||||
# if member == array.last
|
||||
# ary += member.id.to_s + ")"
|
||||
# else
|
||||
# ary += member.id.to_s + ","
|
||||
# end
|
||||
#end
|
||||
ary
|
||||
end
|
||||
|
||||
def get_student_batch_homework_list bid,user
|
||||
student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC")
|
||||
student_batch_homework_list
|
||||
end
|
||||
|
||||
#########################################################
|
||||
#sw
|
||||
#获取学生未进行匿评的数量
|
||||
#param: bid => 作业 user => 用户
|
||||
#return 指定用户未进行匿评的作业的数量
|
||||
#user必须是学生用户
|
||||
#######################################################
|
||||
def get_student_not_batch_homework_list bid,user
|
||||
HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id}) AS table1
|
||||
WHERE table1.m_score IS NULL").count
|
||||
end
|
||||
# #判断是否具有删除的权限
|
||||
# def attach_delete(project)
|
||||
# if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
# #作业添加、编辑界面的tab页
|
||||
# def homework_settings_tabs f
|
||||
# @f = f
|
||||
# tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
||||
# {:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
||||
# ]
|
||||
# end
|
||||
#
|
||||
# #作业可选成员列表分页
|
||||
# def render_new_members_for_homework members
|
||||
# #scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
||||
# #scope = project.members
|
||||
# #principals = paginateHelper members,10
|
||||
# #principals = members
|
||||
# #principal_count = members.count
|
||||
# #limit = 10
|
||||
# #principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||
# #offset ||= principal_pages.offset
|
||||
# #principals = members[offset, limit]
|
||||
# users = members.map(&:user)
|
||||
# s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', users), :id => 'principals')
|
||||
# links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||
# link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@homework)), :remote => true }
|
||||
# return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
||||
# end
|
||||
#
|
||||
# #扩展的checkbox生成
|
||||
# def member_check_box_tags_ex(name, principals)
|
||||
# s = ''
|
||||
# principals.each do |member|
|
||||
# s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.name }</label><br/>"
|
||||
# end
|
||||
# s.html_safe
|
||||
# end
|
||||
#
|
||||
# def paginateHelper obj, pre_size=20
|
||||
# @obj_count = obj.count
|
||||
# @obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
|
||||
# if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
|
||||
# obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
|
||||
# elsif obj.kind_of? Array
|
||||
# obj[@obj_pages.offset, @obj_pages.per_page]
|
||||
# else
|
||||
# logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
|
||||
# raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def user_projects_option
|
||||
# cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||
# memberships = User.current.memberships.all(:conditions => cond)
|
||||
# projects = memberships.map(&:project)
|
||||
# not_have_project = []
|
||||
# not_have_project << Setting.please_chose
|
||||
# not_have_project << 0
|
||||
# type = []
|
||||
# type << not_have_project
|
||||
# projects.each do |project|
|
||||
# if project != nil
|
||||
# option = []
|
||||
# option << project.name
|
||||
# option << project.id
|
||||
# type << option
|
||||
# end
|
||||
# end
|
||||
# type
|
||||
# end
|
||||
#
|
||||
# #判断指定用户是不是已经赞过该作业
|
||||
# def is_praise_homework user_id, obj_id
|
||||
# PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").empty?
|
||||
# end
|
||||
#
|
||||
# #获取赞的总数
|
||||
# def praise_homework_count obj_id
|
||||
# PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
|
||||
# end
|
||||
#
|
||||
# #获取用户对作业的评分
|
||||
# def get_homework_score user, homework
|
||||
# temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
|
||||
# @m_score = temp.nil? ? 0:temp.stars.to_i
|
||||
# end
|
||||
#
|
||||
# #获取评分对应的评论
|
||||
# def get_homework_review homework,is_teacher,user
|
||||
# homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
|
||||
# end
|
||||
#
|
||||
# def convert_array array
|
||||
# ary = "("
|
||||
# if array.nil? || array.count == 0
|
||||
# return "()"
|
||||
# end
|
||||
# array.length.times do |i|
|
||||
# if i == array.length - 1
|
||||
# ary += array[i].id.to_s + ")"
|
||||
# else
|
||||
# if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "")
|
||||
# ary += array[i].id.to_s + ","
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# #array.each do |member|
|
||||
# # if member == array.last
|
||||
# # ary += member.id.to_s + ")"
|
||||
# # else
|
||||
# # ary += member.id.to_s + ","
|
||||
# # end
|
||||
# #end
|
||||
# ary
|
||||
# end
|
||||
#
|
||||
# def get_student_batch_homework_list bid,user
|
||||
# student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
|
||||
# (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
|
||||
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score
|
||||
# FROM homework_attaches
|
||||
# INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
# WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC")
|
||||
# student_batch_homework_list
|
||||
# end
|
||||
#
|
||||
# #########################################################
|
||||
# #sw
|
||||
# #获取学生未进行匿评的数量
|
||||
# #param: bid => 作业 user => 用户
|
||||
# #return 指定用户未进行匿评的作业的数量
|
||||
# #user必须是学生用户
|
||||
# #######################################################
|
||||
# def get_student_not_batch_homework_list bid,user
|
||||
# HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
|
||||
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score
|
||||
# FROM homework_attaches
|
||||
# INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
# WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id}) AS table1
|
||||
# WHERE table1.m_score IS NULL").count
|
||||
# end
|
||||
end
|
@ -0,0 +1,76 @@
|
||||
<div class="contextual">
|
||||
<%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
|
||||
</div>
|
||||
|
||||
<h3>
|
||||
<%=l(:label_course_all)%>
|
||||
</h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset>
|
||||
<label for='name'>
|
||||
课程:
|
||||
</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<a class="icon icon-reload" onclick="$('#name').val('')" style="cursor: pointer;text-decoration: none;">
|
||||
<%= l(:button_clear)%>
|
||||
</a>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
课程
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
主讲老师
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
学时
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
<%=l(:field_is_public)%>
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
<%=l(:field_created_on)%>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= course.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
|
||||
<span>
|
||||
<%= link_to(course.name, course_path(course.id)) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= course.class_period %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= checked_image course.is_public? %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(course.created_at) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_course_all)) -%>
|
@ -1,8 +1,9 @@
|
||||
<div style="width: 57%;margin: 10px auto;">
|
||||
<div style="width: 67%;margin: 10px auto;">
|
||||
<%= form_tag( search_stores_path, method: 'post') do %>
|
||||
<%= text_field_tag 'name', params[:name], placeholder: l('welcome.search.information'), name: "name", :class => 'blueinputbar', :style => 'width:450px;'%>
|
||||
|
||||
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise "%>
|
||||
<% end %>
|
||||
<%= link_to("导出缺失列表",lost_file_stores_path(:format => 'xls'),:style => "background-color: #15bccf;padding: 4px 5px;color: white;") if User.current.admin?%>
|
||||
<div class='font_lighter' style="display: inline-block; margin-top:3px;"><%= l(:label_resources_search_all)%></div>
|
||||
</div>
|
@ -0,0 +1,58 @@
|
||||
<!-- 作品列表,显示某一个作品的信息 -->
|
||||
<ul class="hwork_ul <%= cycle("b_grey", "") %>" id="student_work_<%= student_work.id%>">
|
||||
<li class="hwork_num">
|
||||
<span>
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</span>
|
||||
</li>
|
||||
<li class=" hwork_name ">
|
||||
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
|
||||
</li>
|
||||
<li class=" hwork_tit">
|
||||
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
||||
</li>
|
||||
<li class=" hwork_time_c">
|
||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red">迟交</span>
|
||||
<% else%>
|
||||
<%= student_work.created_at.strftime("%m-%d").to_s%>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" hwork_score <%= score_color student_work.teacher_score%>">
|
||||
<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
|
||||
</li>
|
||||
<li class=" hwork_score <%= score_color student_work.teaching_asistant_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?%>
|
||||
<span class="">
|
||||
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
|
||||
</span>
|
||||
<div class="info_ni">
|
||||
现共有
|
||||
<span class="c_red"> <%= student_work.student_works_scores.where(:reviewer_role => 3).count%> </span>
|
||||
名学生进行了匿评,平均分为
|
||||
<span class="c_red"> <%= format("%.1f",student_work.student_score)%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : student_work.final_score - student_work.absence_penalty - student_work.late_penalty%>
|
||||
<li class=" hwork_score <%= score_color score%> student_final_scor_info">
|
||||
<%= score.nil? ? "--" : format("%.1f",score)%>
|
||||
<% unless score.nil?%>
|
||||
<div class="info_ni">
|
||||
作品最终评分为
|
||||
<span class="c_red"> <%= student_work.final_score%> </span>分。
|
||||
迟交扣分
|
||||
<span class="c_red"> <%= student_work.late_penalty%> </span>分,
|
||||
缺评扣分
|
||||
<span class="c_red"> <%= student_work.absence_penalty%> </span>分,
|
||||
最终成绩为
|
||||
<span class="c_red"> <%= format("%.1f",score)%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul><!---hwork_ul end-->
|
@ -0,0 +1,43 @@
|
||||
<li class="hwork_num ">
|
||||
<span class="c_dark f14 fb fl">学号</span>
|
||||
</li>
|
||||
<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 class="hwork_tit">
|
||||
<span class="c_dark f14 fb fl">作品名称</span>
|
||||
</li>
|
||||
<li class=" hwork_time f14 fb c_dark">
|
||||
<%= 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"%>
|
||||
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% 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"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<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"%>
|
||||
<% if @show_all && @order == "teaching_asistant_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
|
||||
<% end%>
|
||||
</li>
|
||||
<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"%>
|
||||
<% if @show_all && @order == "student_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="ml20">
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
@ -0,0 +1,14 @@
|
||||
<div id="popbox02">
|
||||
<div class="ni_con_work">
|
||||
<p>
|
||||
当前作业
|
||||
<span class="c_pink">已开启匿评</span>
|
||||
您提交作品后将
|
||||
<span class="c_pink">不会收到任何匿评作品</span>,
|
||||
您的作品也
|
||||
<span class="c_pink">不会被其他用户匿评</span>.
|
||||
如需获得最终成绩,请您联系主讲老师对您的作品单独进行评分
|
||||
</p>
|
||||
<a href="javascript:void(0)" class="tijiao" style="margin-left:200px;" onclick="clickCanel()">确定</a>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,9 @@
|
||||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<h2><img src="/images/bid/pic_top.jpg" width="188" height="37" alt="匿名评价" /></h2>
|
||||
<p> 据说雷锋做完好事是从来不留名的呢,我们这次评分也不留名!!!但是,但是,您给的分数一定要公正哦,老天爷看不到,我们的系统可是清楚得很!</p>
|
||||
<p style="margin-bottom:15px;"> 别怪我没告诉你,系统分配给你的作品不评价可是要扣分的哈!</p>
|
||||
<a href="javascript:" class="tijiao" style="margin-left:100px;" onclick="clickCanel()">匿名评分</a>
|
||||
<a href="javascript:" style="color:#15bccf; margin-top:20px; display:block;" onclick="clickCanel()">冒着扣分的危险残忍拒绝</a>
|
||||
</div>
|
||||
</div>
|
@ -1,6 +1,7 @@
|
||||
$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score}) %>");
|
||||
<% if @status && @status == 1%>
|
||||
$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
|
||||
$("#add_score_reply_<%= @score.id%>").hide();
|
||||
<% else%>
|
||||
alert("回复内容不能为空");
|
||||
<% end%>
|
@ -1,6 +1,9 @@
|
||||
<style type="text/css">
|
||||
p.lablewidth>label{width:190px;}
|
||||
</style>
|
||||
<%= labelled_fields_for :pref, @user.pref do |pref_fields| %>
|
||||
<p><%= pref_fields.check_box :hide_mail %></p>
|
||||
<p style="width:520px;"><%= pref_fields.time_zone_select :time_zone, nil, :include_blank => true %></p>
|
||||
<p style="width:477px;"><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p>
|
||||
<p class="lablewidth"><%= pref_fields.check_box :hide_mail %></p>
|
||||
<p class="lablewidth" style="width:520px;"><%= pref_fields.time_zone_select :time_zone, nil, :include_blank => true %></p>
|
||||
<p class="lablewidth" style="width:477px;"><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p>
|
||||
|
||||
<% end %>
|
||||
|
@ -0,0 +1,13 @@
|
||||
class DeleteSameScore < ActiveRecord::Migration
|
||||
def up
|
||||
student_work_scores = StudentWorksScore.find_by_sql("SELECT * FROM student_works_scores AS a
|
||||
WHERE (a.student_work_id,a.user_id) IN (SELECT student_work_id,user_id FROM student_works_scores GROUP BY student_work_id,user_id HAVING COUNT(*) > 1)
|
||||
AND id NOT IN (SELECT MIN(id) FROM student_works_scores GROUP BY student_work_id,user_id HAVING COUNT(*)>1)")
|
||||
student_work_scores.each do |score|
|
||||
score.destroy
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class AddLatePenaltyToStudnetWork < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :student_works, :late_penalty, :integer, default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :student_works, :late_penalty
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class AddAbsencePenaltyToStudnetWork < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :student_works, :absence_penalty, :integer, default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :student_works, :absence_penalty
|
||||
end
|
||||
end
|
Loading…
Reference in new issue