From 0b565b1be00a6bff64e1f69e0b625fd1aa61545f Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 19 Oct 2015 17:34:59 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E7=A7=81=E6=9C=89=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E4=BB=B6=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20151019085603_update_attachments.rb | 23 +++++++++++++++++++ db/schema.rb | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20151019085603_update_attachments.rb diff --git a/db/migrate/20151019085603_update_attachments.rb b/db/migrate/20151019085603_update_attachments.rb new file mode 100644 index 000000000..bd3ec2325 --- /dev/null +++ b/db/migrate/20151019085603_update_attachments.rb @@ -0,0 +1,23 @@ +class UpdateAttachments < ActiveRecord::Migration + def up + count = Attachment.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + Attachment.page(i).per(30).each do |attachment| + if attachment.container_type == 'Course' + course = attachment.course + if course + if course.is_public == 0 && attachment.attachtype == 1 + attachment.is_public = 0 + attachment.save + end + end + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 4a0d2312a..44548ad9c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151014023806) do +ActiveRecord::Schema.define(:version => 20151019085603) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From ec1eddbf073894396800b5fd1a7451fc9cdf0b21 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 19 Oct 2015 18:19:27 +0800 Subject: [PATCH 02/13] =?UTF-8?q?1.=E5=AD=A6=E7=94=9F=E7=9A=84=E2=80=9C?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=BA=86=E4=BD=9C=E4=B8=9A=E2=80=9D=E6=B6=88?= =?UTF-8?q?=E6=81=AF=EF=BC=8C=E9=93=BE=E6=8E=A5=E5=88=B0=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=95=8C=E9=9D=A2=EF=BC=8C=E8=80=8C=E9=9D=9E?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4=E5=88=97=E8=A1=A8=EF=BC=9B?= =?UTF-8?q?=202.=E5=BC=80=E8=AF=BE=E5=AD=A6=E6=9C=9F=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E5=88=B0=E6=9F=90=E5=B9=B4=EF=BC=8C=E5=A6=82=E2=80=9C=E7=A7=8B?= =?UTF-8?q?=E5=AD=A3=E5=AD=A6=E6=9C=9F=E2=80=9D=EF=BC=8C=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E2=80=9C2015=E5=B9=B4=E7=A7=8B=E5=AD=A3=E5=AD=A6=E6=9C=9F?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 7f535f2ec..e5105561d 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -44,10 +44,18 @@ ">发布了课程作业:
  • - <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), - :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", - :onmouseover =>"message_titile_show($(this),event)", - :onmouseout => "message_titile_hide($(this))" %>
  • + <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %> + <%= link_to ma.course_message.name, new_student_work_path(:homework => ma.course_message.id), + :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %> + <% else %> + <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), + :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :onmouseover => "message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %> + <% end %> +
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -201,7 +209,7 @@

    失败原因:提交作品的人数低于2人

    作业详情如下:

    -

    课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)

    +

    课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)

    作业标题:<%= ma.course_message.name %>

    提交截止:<%= ma.course_message.end_time%>  24点 @@ -288,7 +296,7 @@ :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>

  • <%= time_tag(ma.created_at).html_safe %>
  • From dbbdae1be24c5e310765a57cb2de7b1ad4a26c27 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 20 Oct 2015 09:24:50 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E9=99=84=E4=BB=B6=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20151019085603_update_attachments.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20151019085603_update_attachments.rb b/db/migrate/20151019085603_update_attachments.rb index bd3ec2325..afb63a277 100644 --- a/db/migrate/20151019085603_update_attachments.rb +++ b/db/migrate/20151019085603_update_attachments.rb @@ -7,7 +7,7 @@ class UpdateAttachments < ActiveRecord::Migration if attachment.container_type == 'Course' course = attachment.course if course - if course.is_public == 0 && attachment.attachtype == 1 + if course.is_public == 0 attachment.is_public = 0 attachment.save end From 50abd3785afcbf2d682c4f7e561ccef408995230 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 20 Oct 2015 09:42:26 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=9C=A8=E5=89=8D?= =?UTF-8?q?=E9=9D=A2=E7=BB=9F=E4=B8=80=E5=8A=A0=E4=B8=8A=E2=80=9C=E6=9F=90?= =?UTF-8?q?=E6=9F=90=E6=82=A8=E5=A5=BD=EF=BC=81=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index e5105561d..6c22976fd 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -296,6 +296,10 @@ :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>