diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 1841c90ea..041c63a8e 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -101,9 +101,6 @@ class HomeworkAttachController < ApplicationController :project_id => project_id } - - #@homework_list = @bid.homeworks - @homework = HomeworkAttach.new(options) @homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@homework) @@ -126,18 +123,8 @@ class HomeworkAttachController < ApplicationController def new @bid = Bid.find(params[:id]) - if User.current.admin? || User.current.member_of_course?(@bid.courses.first) #nwb - #该课程的学生的集合(新建不实现功能:添加成员) - #@members = @bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id <> #{User.current.id}", {:role_id => [5, 10]}) - - #@members = paginateHelper @members,10 - #@all_user = [] - #@bid.courses.first.members.each do |member| - # @all_user << member.user - #end + if User.current.admin? || User.current.member_of_course?(@bid.courses.first) @homework = HomeworkAttach.new - #@homework_user = members_for_homework(@homework) + User.current - #@members = @all_user - @homework_user respond_to do |format| format.html # new.html.erb format.json { render json: @homework } @@ -171,7 +158,6 @@ class HomeworkAttachController < ApplicationController #users:该作业所有成员 #q:模糊匹配的用户的昵称 def members_for_homework homework,users,q - #homework.bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id not in (:users)", {:role_id => [5, 10],:users => users}).joins(:user).where("users.login like '%#{q}%'") unpartin_users = homework.bid.courses.first.members.where("user_id not in (:users)", {:users => users}).joins(:user).where("users.login like '%#{q}%'") canpartin_users = [] unpartin_users.each do |m| @@ -183,9 +169,7 @@ class HomeworkAttachController < ApplicationController end def edit - #@homework = HomeworkAttach.find(params[:id]) if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) - #@members = @homework.bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id)", {:role_id => [5, 10]}) get_homework_member @homework else render_403 :message => :notice_not_authorized @@ -226,7 +210,6 @@ class HomeworkAttachController < ApplicationController end def destroy - #@homework = HomeworkAttach.find(params[:id]) if User.current.admin? || User.current == @homework.user if @homework.destroy respond_to do |format| @@ -242,7 +225,6 @@ class HomeworkAttachController < ApplicationController #显示作业信息 def show - #@homework = HomeworkAttach.find(params[:id]) if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) # 打分统计 stars_reates = @homework. @@ -279,13 +261,6 @@ class HomeworkAttachController < ApplicationController #删除留言 def destroy_jour @journal_destroyed = JournalsForMessage.delete_message(params[:object_id]) - #@homework = HomeworkAttach.find(params[:id]) - #@jours = @homework.journals_for_messages.order("created_on DESC") - #@limit = 10 - #@feedback_count = @jours.count - #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - #@offset ||= @feedback_pages.offset - #@jour = @jours[@offset, @limit] respond_to do |format| format.js end @@ -322,14 +297,6 @@ class HomeworkAttachController < ApplicationController #获取指定作业的平均得分 def score - #stars_reates = @homework.rates(:quality) - #percent = 0 - #stars_reates.each do |star_reates| - # percent = percent + star_reates.stars - #end - #stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count - #result = percent * 1.0 / stars_reates_count - #result end #添加回复 diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index 3cce7bdae..cd1e4e425 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -62,7 +62,7 @@ 描      述  : - <%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => 65534 %> + <%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => 5000 %>