一些修订

This commit is contained in:
baiyu 2013-09-22 16:11:39 +08:00
parent c2302dc0c7
commit 1c4f7f99e8
5 changed files with 31 additions and 2 deletions

View File

@ -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'

View File

@ -0,0 +1,4 @@
未交作业人数(
<% %>
已交作业人数

View File

@ -121,6 +121,7 @@
<ul>
<li><%= link_to l(:label_question_student), { :controller => 'bids', :action => 'show' },:class => link_class(:respond)%></li>
<li><%= link_to l(:label_homework_commit), { :controller => 'bids', :action => 'show_project' },:class => link_class(:project)%></li>
<!-- <li><%= link_to l(:label_homework_statistics), { :controller => 'bids', :action => 'homework_statistics' },:class => link_class(:homework_statistics)%></li> -->
<!-- <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
--><ul>
</div>

View File

@ -1496,4 +1496,5 @@ zh:
label_course_new_homework: 新建作业
label_course_homework_list: 作业列表
label_course_homework_new: 发布作业
label_course_data: 资料
label_course_data: 资料
label_homework_statistics: 作业统计

View File

@ -443,6 +443,7 @@ RedmineApp::Application.routes.draw do
match 'calls/create_bid', :to => 'bids#create_bid'
match 'calls/create_homework', :to => 'bids#create_homework'
match 'calls/:id/homework_respond', :to => 'bids#homework_respond'
match 'calls/:id/homework_statistics', :to => 'bids#homework_statistics'
post 'join_in/join', :to => 'courses#join', :as => 'join'
delete 'join_in/join', :to => 'courses#unjoin'