Merge branch 'develop' into szzh

This commit is contained in:
sw 2015-04-15 10:22:10 +08:00
commit ed5911eab5
3 changed files with 10 additions and 6 deletions

View File

@ -51,7 +51,7 @@ class HomeworkAttachController < ApplicationController
order_by = "created_at #{direction}"
end
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).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 is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(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 AND stars > 0 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
FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}) AS table1
@ -483,7 +483,7 @@ class HomeworkAttachController < ApplicationController
get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id
elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.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 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 AND stars > 0 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
FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "3" #全部作业列表
@ -610,7 +610,7 @@ class HomeworkAttachController < ApplicationController
(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
FROM homework_attaches WHERE bid_id = #{bid_id}
ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NULL")
WHERE table1.t_score IS NULL OR table1.t_score = 0 ")
@all_homework_list = search_homework_member(@all_homework_list,@search_name.to_s.downcase) if @search_name
@homework_list = paginateHelper @all_homework_list,10
end

View File

@ -37,6 +37,8 @@
.span_wping a:hover{ background-color:#03a1b3;}
.span_wping_background{background: #CCC !important;}
.font_lighter_sidebar img{max-width: 100%}
/*上传图片处理*/
.upload_img img{max-width: 100%;}
</style>
</head>
<body class="<%= h body_css_classes %>">
@ -122,7 +124,7 @@
<!--count-->
<div class="inf_user_image">
<table>
<table style="width: 100%;">
<% if (User.current.admin?||User.current.allowed_to?(:as_teacher,course)) %>
<tr>
<td valign="top" style="padding-left: 8px; font-size: 15px" colspan="2">
@ -151,8 +153,8 @@
</tr>
<tr>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;" title="<%= @bid.description %>">
<%= @bid.description.html_safe %>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;">
<div class="upload_img" style="width: 210px;"><%= @bid.description.html_safe %></div>
</td>
</tr>

View File

@ -184,6 +184,8 @@ a.member_search {
padding: 4px 6px;
text-decoration: none;
}
/*上传图片处理*/
.upload_img img{max-width: 100%;}