From 78dff36d7a7b080e28f463b1a5ce0abbdfe1a355 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 09:06:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=8F=AA=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E4=B8=8D=E8=AF=84=E5=88=86=E7=9A=84=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8D=B4=E5=9C=A8=E5=B7=B2=E8=AF=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ae4e66d1c..a2d5ef456 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -606,7 +606,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 From d1f42a3954b8b09fb558b4e74c1eec0ed45b3509 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 09:52:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=8F=AA=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E4=B8=8D=E8=AF=84=E5=88=86=E7=9A=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=9C=A8=E6=9C=AA=E6=89=B9=E5=92=8C=E5=B7=B2=E6=89=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E9=83=BD=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index a2d5ef456..c90d078e2 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -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" #全部作业列表 @@ -606,11 +606,11 @@ 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 AND stars > 0 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 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 - 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 From 61df6e144d548254d132db6f9c73900714c57dcf Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 10:06:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8QQ=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E6=98=BE=E7=A4=BA=E8=B6=85=E5=87=BA=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_homework.html.erb | 8 +++++--- public/stylesheets/css.css | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 1e6b9bca2..96671cc6d 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -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%;} @@ -122,7 +124,7 @@
- +
<% if (User.current.admin?||User.current.allowed_to?(:as_teacher,course)) %> - diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 6d2113d4b..2b820381e 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -184,6 +184,8 @@ a.member_search { padding: 4px 6px; text-decoration: none; } +/*上传图片处理*/ +.upload_img img{max-width: 100%;}
@@ -151,8 +153,8 @@
- <%= @bid.description.html_safe %> + +
<%= @bid.description.html_safe %>