From 1c4f7f99e829d732ea06c0d996f4f5cc3b4bb2a6 Mon Sep 17 00:00:00 2001 From: baiyu <1554253403@qq.com> Date: Sun, 22 Sep 2013 16:11:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BF=AE=E8=AE=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 24 ++++++++++++++++++++- app/views/bids/homework_statistics.html.erb | 4 ++++ app/views/layouts/base_homework.html.erb | 1 + config/locales/zh.yml | 3 ++- config/routes.rb | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 app/views/bids/homework_statistics.html.erb diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index d8f5e15dd..83af48ae4 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -4,12 +4,14 @@ class BidsController < ApplicationController menu_item :respond menu_item :project, :only => :show_project menu_item :homework_respond, :only => :homework_respond + menu_item :homework_statistics, :only => :homework_statistics #Ended by young - before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add, :new, :homework_respond, :add_homework] + before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add, :new, :homework_respond, :add_homework, :homework_statistics] helper :watchers helper :attachments include AttachmentsHelper + def index # Modified by nie # @requirement_title = "4" @@ -365,6 +367,26 @@ class BidsController < ApplicationController end + # 作业统计 + def homework_statistics + @course = @bid.courses.first + @member = [] + @course.memberships.each do |member| + unless (member.roles && Role.where('id = ? ', 3)).empty? + @member.push member + end + end + if @bid.homework_type = 1 + @student = User.where("id in (select DISTINCT user_id from #{HomeworkAttach.table_name} where bid_id = ? )", @bid.id) + @homework_type = true + else + + @homework_type = false + end + @user = @bid.author + render :layout => 'base_homework' + end + def homework_respond @user = @bid.author render :layout => 'base_homework' diff --git a/app/views/bids/homework_statistics.html.erb b/app/views/bids/homework_statistics.html.erb new file mode 100644 index 000000000..9f98364cc --- /dev/null +++ b/app/views/bids/homework_statistics.html.erb @@ -0,0 +1,4 @@ +未交作业人数( +<% %>) + +已交作业人数 \ No newline at end of file diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 2762a0978..2b7fa7552 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -121,6 +121,7 @@