Merge branch 'szzh' into dev_hjq
This commit is contained in:
commit
b089b973ab
|
@ -26,7 +26,8 @@ module Mobile
|
|||
present :data, {token: key.access_token, user: api_user}, using: Entities::Auth
|
||||
present :status, 0
|
||||
else
|
||||
raise "无效的用户名或密码"
|
||||
present :message, "无效的用户名或密码"
|
||||
present :status,1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -113,6 +113,20 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc '通知评论列表'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :notice_id,type:Integer,desc:'通知id'
|
||||
optional :page,type:Integer,desc:'页码'
|
||||
end
|
||||
get ':notice_id/notice_comments' do
|
||||
cs = CommentService.new
|
||||
comments = cs.notice_comments params,current_user
|
||||
present :data, comments, with: Mobile::Entities::Comment
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -312,16 +312,19 @@ module Mobile
|
|||
present :status,0
|
||||
end
|
||||
|
||||
desc '课程历次作业总成绩列表'
|
||||
desc '总成绩 or 活跃度列表'
|
||||
params do
|
||||
requires :token,type:String
|
||||
requires :course_id,type:Integer,desc:'课程id'
|
||||
optional :page,type:Integer,desc:'页码'
|
||||
optional :type,type:Integer,desc:'0是活跃度,1是成绩'
|
||||
end
|
||||
get ':course_id/students_score_list' do
|
||||
cs = CoursesService.new
|
||||
news = cs.students_score_list params,current_user
|
||||
present :data,news,with:Mobile::Entities::User
|
||||
present :data,news[:user_list],with:Mobile::Entities::User
|
||||
present :maxSize,news[:max_size]
|
||||
present :status,0
|
||||
end
|
||||
|
||||
desc '课程某次作业提交列表 并显示成绩'
|
||||
|
|
|
@ -56,6 +56,8 @@ module Mobile
|
|||
expose :comments, using: Mobile::Entities::Comment do |f, opt|
|
||||
if f.is_a?(Hash) && f.key?(:comments)
|
||||
f[:comments]
|
||||
elsif f.is_a?(::News) && f.respond_to?(:comments)
|
||||
f.send(:comments)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class OrganizationController < ApplicationController
|
||||
layout 'base_projects'
|
||||
# layout 'base_projects'
|
||||
before_filter :require_admin, :except => [:index]
|
||||
|
||||
def index
|
||||
|
|
|
@ -93,7 +93,7 @@ module ApiHelper
|
|||
def homework_status_desc homework
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
link = "截止日期之前不可启动匿评"
|
||||
link = show_homework_deadline homework
|
||||
elsif homework.student_works.count >= 2 #作业份数大于2
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
|
@ -104,10 +104,10 @@ module ApiHelper
|
|||
link = " 匿评结束"
|
||||
end
|
||||
else
|
||||
link = "提交作业数大于2才可启动匿评"
|
||||
link = "提交作业数过少"
|
||||
end
|
||||
else
|
||||
link = "未开启匿评作业不可启动匿评"
|
||||
link = "未开启匿评作业"
|
||||
end
|
||||
link
|
||||
end
|
||||
|
@ -158,7 +158,7 @@ module ApiHelper
|
|||
if homework_eva_task_num == 0
|
||||
0
|
||||
else
|
||||
( homework_eva_completed_task_num / homework_eva_task_num.to_f * 100 ) .round(2)
|
||||
( homework_eva_completed_task_num / homework_eva_task_num.to_f * 100 ) .round(1)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -520,10 +520,14 @@ module CoursesHelper
|
|||
option1 << l(:label_spring)
|
||||
option1 << l(:label_spring)
|
||||
option2 = []
|
||||
option2 << l(:label_autumn)
|
||||
option2 << l(:label_autumn)
|
||||
option2 << l(:label_summer)
|
||||
option2 << l(:label_summer)
|
||||
option3 = []
|
||||
option3 << l(:label_autumn)
|
||||
option3 << l(:label_autumn)
|
||||
type << option1
|
||||
type << option2
|
||||
type << option3
|
||||
type
|
||||
end
|
||||
|
||||
|
@ -546,8 +550,9 @@ module CoursesHelper
|
|||
end
|
||||
if cur_course_term == "秋季学期" && course.time == (year_now + 1) && course.term == "春季学期"
|
||||
is_next_term = true
|
||||
elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "秋季学期"
|
||||
elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "夏季学期"
|
||||
is_next_term = true
|
||||
elsif cur_course_term == "夏季学期" && course.time == year_now && course.term == "秋季学期"
|
||||
end
|
||||
is_current_term || is_next_term
|
||||
end
|
||||
|
|
|
@ -3,7 +3,8 @@ module HomeworkCommonHelper
|
|||
#迟交扣分下拉框
|
||||
def late_penalty_option
|
||||
type = []
|
||||
for i in (0..5)
|
||||
type << l(:lable_unset)
|
||||
for i in (1..5)
|
||||
option = []
|
||||
option << i
|
||||
option << i
|
||||
|
@ -29,7 +30,8 @@ module HomeworkCommonHelper
|
|||
#缺评扣分
|
||||
def absence_penalty_option
|
||||
type = []
|
||||
i = 0
|
||||
i = 1
|
||||
type << l(:lable_unset)
|
||||
while i <= 5
|
||||
option = []
|
||||
option << i
|
||||
|
@ -50,4 +52,32 @@ module HomeworkCommonHelper
|
|||
end
|
||||
link
|
||||
end
|
||||
|
||||
#评分规则显示
|
||||
def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil
|
||||
if absence_penalty
|
||||
if late_penalty.to_i == 0 && absence_penalty.to_i == 0
|
||||
notice = "尚未设置评分规则"
|
||||
if is_teacher
|
||||
notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
|
||||
end
|
||||
elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0
|
||||
notice = "迟交扣#{late_penalty}分,缺评扣分未设置"
|
||||
elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0
|
||||
notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}分"
|
||||
elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0
|
||||
notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}分"
|
||||
end
|
||||
else
|
||||
if late_penalty.to_i == 0
|
||||
notice = "尚未设置评分规则"
|
||||
if is_teacher
|
||||
notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
|
||||
end
|
||||
else
|
||||
notice = "迟交扣#{late_penalty}分"
|
||||
end
|
||||
end
|
||||
notice.html_safe
|
||||
end
|
||||
end
|
|
@ -169,14 +169,14 @@ module WatchersHelper
|
|||
if joined
|
||||
link_to text, {:controller => "courses", :action => "join_group", :object_id => "#{group.id}"},
|
||||
:remote => true, :method => 'delete',
|
||||
:id => "#{group.id}", :style => "padding: 8px 8px 4px; ",
|
||||
:id => "#{group.id}", :style => "padding: 2px 8px 2px; background-color:#15bccf; color:#fff; ",
|
||||
:confirm => l(:text_are_you_sure_out_group), :class => 'group_in'
|
||||
|
||||
end
|
||||
else
|
||||
text = l(:label_new_join_group)
|
||||
form_tag({:controller => "courses", :action => "join_group", :object_id => "#{group.id}"}, :remote => true, :method => 'post') do
|
||||
submit_tag text, class: "group_in", style: "width: 90px;height: 21px;"
|
||||
submit_tag text, class: "group_in", style: "width: 90px;height: 21px; background-color:#15bccf; color:#fff;"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -112,6 +112,9 @@ class CommentService
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# 获取课程里的某个通知的所有回复
|
||||
def notice_comments params,current_user
|
||||
News.find(params[:notice_id]).comments.page(params[:page] || 1).per(10)
|
||||
end
|
||||
|
||||
end
|
|
@ -333,13 +333,13 @@ class CoursesService
|
|||
def homework_list params,current_user
|
||||
course = Course.find(params[:id])
|
||||
if course.is_public != 0 || current_user.member_of_course?(course)
|
||||
bids = course.homework_commons.page(1).per(20).order('created_at DESC')
|
||||
bids = course.homework_commons.page(params[:page] || 1).per(20).order('created_at DESC')
|
||||
bids = bids.like(params[:name]) if params[:name].present?
|
||||
homeworks = []
|
||||
bids.each do |bid|
|
||||
homeworks << show_homework_info(course,bid,current_user,is_course_teacher(current_user,course))
|
||||
end
|
||||
homeworks
|
||||
homeworks = []
|
||||
bids.each do |bid|
|
||||
homeworks << show_homework_info(course,bid,current_user,is_course_teacher(current_user,course))
|
||||
end
|
||||
homeworks
|
||||
else
|
||||
raise '403'
|
||||
end
|
||||
|
@ -552,17 +552,28 @@ class CoursesService
|
|||
else
|
||||
end
|
||||
end
|
||||
studentlist = []
|
||||
bid.student_works.order("created_at desc").page(1).per(6).each do |work|
|
||||
studentlist << work.user
|
||||
end
|
||||
unless is_course_teacher
|
||||
homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
|
||||
end
|
||||
# studentlist = []
|
||||
# bid.student_works.order("created_at desc").page(1).per(6).each do |work|
|
||||
# studentlist << work.user
|
||||
# end
|
||||
# unless is_course_teacher
|
||||
# homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
|
||||
# end
|
||||
#end
|
||||
open_anonymous_evaluation = bid.homework_detail_manual.comment_status
|
||||
{:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.user,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_at,:deadline => bid.end_time,:studentlist => studentlist}
|
||||
{:course_name => course.name,:course_id => course.id,:id => bid.id,
|
||||
:author => bid.user,:author_real_name => author_real_name,
|
||||
:homework_times => many_times, :homework_name => name,
|
||||
:homework_count => homework_count,:student_questions_count => 0,
|
||||
:description => description, :homework_state => state,
|
||||
:open_anonymous_evaluation => open_anonymous_evaluation,
|
||||
#:homework_for_anonymous_comments => homework_for_anonymous_comments,
|
||||
:created_on => bid.created_at,:deadline => bid.end_time,
|
||||
:homework_notsubmit_num => bid.course.members.count - bid.student_works.count,
|
||||
:homework_submit_num => bid.student_works.count,
|
||||
:homework_status_student => get_homework_status( bid),:homework_status_teacher => homework_status_desc( bid),
|
||||
:student_evaluation_part => get_evaluation_part( bid ,3),
|
||||
:ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?}
|
||||
|
||||
end
|
||||
|
||||
|
@ -719,11 +730,33 @@ class CoursesService
|
|||
|
||||
# 获取课程历次作业的学生总成绩
|
||||
def students_score_list params,current_user
|
||||
homework_count = Course.find(params[:course_id]).homework_commons.count
|
||||
page = (params[:page] || 1) - 1
|
||||
sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" <<
|
||||
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score limit #{page*10},10"
|
||||
User.find_by_sql(sql)
|
||||
user_list = []
|
||||
max_size = 0
|
||||
if params[:type] == 1
|
||||
homework_count = Course.find(params[:course_id]).homework_commons.count
|
||||
|
||||
sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" <<
|
||||
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score limit #{page*10},10"
|
||||
sql_count = " select count(distinct(student_works.user_id) ) " <<
|
||||
" from student_works left outer join users on student_works.user_id = users.id " <<
|
||||
" where homework_common_id in " <<
|
||||
" ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) "
|
||||
max_size = ActiveRecord::Base.connection().select_value(sql_count)
|
||||
user_list = User.find_by_sql(sql)
|
||||
else
|
||||
sql1 = " select users.*,count(author_id)*2 active_count from messages " <<
|
||||
" LEFT JOIN users on messages.author_id = users.id " <<
|
||||
" where messages.board_id in (select id from boards where boards.course_id = #{params[:course_id]} ) " <<
|
||||
" GROUP BY messages.author_id ORDER BY count(author_id) desc " <<
|
||||
" limit #{page*10},10"
|
||||
sql1_count = " select count(DISTINCT(messages.author_id))" <<
|
||||
" from messages LEFT JOIN users on messages.author_id = users.id " <<
|
||||
" where messages.board_id in (select id from boards where boards.course_id = #{params[:course_id]} )"
|
||||
max_size = ActiveRecord::Base.connection().select_value(sql1_count)
|
||||
user_list = User.find_by_sql(sql1)
|
||||
end
|
||||
{:user_list=>user_list,:max_size=>max_size}
|
||||
end
|
||||
|
||||
# 获取某次作业的所有作业列表
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<img src="/images/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级" />
|
||||
</a>
|
||||
<% end%>
|
||||
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('');$('#edit_group_<%= group.id %>').slideToggle();">
|
||||
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('');$('#edit_group_<%= group.id %>').slideToggle();$('#new_group_name').hide();">
|
||||
<img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" />
|
||||
</a>
|
||||
<% end %>
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
<% if @canShowCode %>
|
||||
<li style="margin-left:15px;margin-top: 2px;">
|
||||
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();">+添加分班</a>
|
||||
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();$('#edit_group_36').hide();">+添加分班</a>
|
||||
</li>
|
||||
<li >
|
||||
<span id="new_group_name" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
||||
|
|
|
@ -61,15 +61,10 @@
|
|||
<div class="mt5">
|
||||
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>
|
||||
<div class="fl mb5 c_red">
|
||||
迟交扣
|
||||
<%= homework.late_penalty%>
|
||||
分
|
||||
<% if homework.homework_type == 1%>
|
||||
,缺评一个作品扣
|
||||
<%= homework.homework_detail_manual.absence_penalty%>
|
||||
分
|
||||
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher,homework.homework_detail_manual.absence_penalty%>
|
||||
<% else%>
|
||||
。
|
||||
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher%>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
|
||||
<div class="recall_head">
|
||||
<% if show_name %>
|
||||
<%= image_tag url_to_avatar(reply.user.show_name),:width => '30',:height => '30' %>
|
||||
<%= image_tag url_to_avatar(journal.user),:width => '30',:height => '30' %>
|
||||
<% else %>
|
||||
<%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %>
|
||||
<% end %>
|
||||
|
|
|
@ -2025,6 +2025,7 @@ zh:
|
|||
label_evaluation_time: 匿评时间
|
||||
|
||||
label_file_lost_list: 缺失文件列表
|
||||
lable_unset: 未设置
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
}
|
||||
.jstEditor textarea, .jstEditor iframe {
|
||||
margin: 0;
|
||||
margin-left: 80px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
.jstHandle {
|
||||
|
|
Loading…
Reference in New Issue