教师数目显示:-1 ,同时动态大量不显示。是不是只显示近期3个月的?
Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
2cd805ef4c
commit
9f807438d6
24
Gemfile
24
Gemfile
|
@ -1,4 +1,4 @@
|
||||||
source 'http://ruby.taobao.org'
|
source 'http://rubygems.org'
|
||||||
#source 'http://ruby.sdutlinux.org/'
|
#source 'http://ruby.sdutlinux.org/'
|
||||||
|
|
||||||
unless RUBY_PLATFORM =~ /w32/
|
unless RUBY_PLATFORM =~ /w32/
|
||||||
|
@ -33,21 +33,21 @@ group :test do
|
||||||
gem 'selenium-webdriver', '~> 2.42.0'
|
gem 'selenium-webdriver', '~> 2.42.0'
|
||||||
|
|
||||||
|
|
||||||
platforms :mri, :mingw do
|
# platforms :mri, :mingw do
|
||||||
group :rmagick do
|
# group :rmagick do
|
||||||
# RMagick 2 supports ruby 1.9
|
# # RMagick 2 supports ruby 1.9
|
||||||
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
|
# # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
|
||||||
# different requirements for the same gem on different platforms
|
# # different requirements for the same gem on different platforms
|
||||||
gem "rmagick", ">= 2.0.0"
|
# gem "rmagick", ">= 2.0.0"
|
||||||
end
|
# end
|
||||||
end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem "guard-rails", '~> 0.5.3'
|
# gem "guard-rails", '~> 0.5.3'
|
||||||
gem 'spork-testunit', '~> 0.0.8'
|
gem 'spork-testunit', '~> 0.0.8'
|
||||||
gem 'guard-spork', '~> 1.5.1'
|
# gem 'guard-spork', '~> 1.5.1'
|
||||||
gem 'guard-test', '~> 1.0.0'
|
# gem 'guard-test', '~> 1.0.0'
|
||||||
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
|
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
|
||||||
gem 'pry'
|
gem 'pry'
|
||||||
gem 'pry-nav'
|
gem 'pry-nav'
|
||||||
|
|
|
@ -810,9 +810,9 @@ class CoursesController < ApplicationController
|
||||||
# modify by nwb
|
# modify by nwb
|
||||||
# 添加私密性判断
|
# 添加私密性判断
|
||||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||||
events = @activity.events(@date_from, @date_to)
|
events = @activity.events(@days, @course.created_at)
|
||||||
else
|
else
|
||||||
events = @activity.events(@date_from, @date_to, :is_public => 1)
|
events = @activity.events(@days, @course.created_at, :is_public => 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
# 无新动态时,显示老动态
|
# 无新动态时,显示老动态
|
||||||
|
|
|
@ -597,8 +597,8 @@ class ProjectsController < ApplicationController
|
||||||
"show_wiki_edits"=>true,
|
"show_wiki_edits"=>true,
|
||||||
"show_journals_for_messages" => true
|
"show_journals_for_messages" => true
|
||||||
}
|
}
|
||||||
@date_to ||= Date.today + 1
|
|
||||||
@date_from = @date_to - @days-1.years
|
|
||||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||||
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
||||||
# 决定显示所用用户或单个用户活动
|
# 决定显示所用用户或单个用户活动
|
||||||
|
@ -612,9 +612,9 @@ class ProjectsController < ApplicationController
|
||||||
# modify by nwb
|
# modify by nwb
|
||||||
# 添加私密性判断
|
# 添加私密性判断
|
||||||
if User.current.member_of?(@project)|| User.current.admin?
|
if User.current.member_of?(@project)|| User.current.admin?
|
||||||
events = @activity.events(@date_from, @date_to)
|
events = @activity.events(@days)
|
||||||
else
|
else
|
||||||
events = @activity.events(@date_from, @date_to, :is_public => 1)
|
events = @activity.events(@days,nil, :is_public => 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
|
|
|
@ -49,7 +49,7 @@ form #search_type{
|
||||||
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
||||||
<div class="project-search" style="float: right">
|
<div class="project-search" style="float: right">
|
||||||
<div class='search_widget'>
|
<div class='search_widget'>
|
||||||
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27, %>
|
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27, style: "float:left" %>
|
||||||
<%= select_tag(:search_type, options_for_select(select_option), :style => "float:right" ) %>
|
<%= select_tag(:search_type, options_for_select(select_option), :style => "float:right" ) %>
|
||||||
</div>
|
</div>
|
||||||
<%#= hidden_field_tag 'project_type', project_type %>
|
<%#= hidden_field_tag 'project_type', project_type %>
|
||||||
|
|
|
@ -89,7 +89,7 @@ form #search_by
|
||||||
<div class="project-search" style="float: right">
|
<div class="project-search" style="float: right">
|
||||||
<div class='search_widget' >
|
<div class='search_widget' >
|
||||||
|
|
||||||
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字' %>
|
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', style:"float:left" %>
|
||||||
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
|
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
|
||||||
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
|
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
|
||||||
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]]), :onchange => "searchByChange();",:style => "float:right" ) %>
|
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]]), :onchange => "searchByChange();",:style => "float:right" ) %>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
class AddDataForMembers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
StudentsForCourse.all.each do |stu|
|
||||||
|
if Member.where(:user_id => stu.student_id, :course_id => stu.course_id).first.nil?
|
||||||
|
mem = Member.new(:user_id => stu.student_id, :course_id => stu.course_id, :course_group_id => 0, :project_id => -1, :mail_notification => 0, :role_ids => [10])
|
||||||
|
mem.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20150108035338) do
|
ActiveRecord::Schema.define(:version => 20150112024820) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
|
@ -50,15 +50,13 @@ module Redmine
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
# Returns events of type event_type visible by user that occured between from and to
|
# Returns events of type event_type visible by user that occured between from and to
|
||||||
def find_events(event_type, user, from, to, options)
|
def find_events(event_type, user, days, created_time, options)
|
||||||
provider_options = activity_provider_options[event_type]
|
provider_options = activity_provider_options[event_type]
|
||||||
raise "#{self.name} can not provide #{event_type} events." if provider_options.nil?
|
raise "#{self.name} can not provide #{event_type} events." if provider_options.nil?
|
||||||
|
|
||||||
scope = self
|
scope = self
|
||||||
|
|
||||||
if from && to
|
|
||||||
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
|
|
||||||
end
|
|
||||||
|
|
||||||
if options[:author]
|
if options[:author]
|
||||||
return [] if provider_options[:author_key].nil?
|
return [] if provider_options[:author_key].nil?
|
||||||
|
@ -93,7 +91,15 @@ module Redmine
|
||||||
ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option."
|
ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option."
|
||||||
scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
|
scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
|
||||||
end
|
end
|
||||||
|
to = scope.select(:created_on).order("created_on desc").first.created_on
|
||||||
|
if options[:course]
|
||||||
|
from = (to - days) > created_time ? (to - days) : created_time.to_date
|
||||||
|
else
|
||||||
|
from = to - days -1.years
|
||||||
|
end
|
||||||
|
if from && to
|
||||||
|
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
|
||||||
|
end
|
||||||
scope.all(provider_options[:find_options].dup)
|
scope.all(provider_options[:find_options].dup)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ module Redmine
|
||||||
|
|
||||||
# Returns an array of events for the given date range
|
# Returns an array of events for the given date range
|
||||||
# sorted in reverse chronological order
|
# sorted in reverse chronological order
|
||||||
def events(from = nil, to = nil, options={})
|
def events(days = nil, created_time = nil, options={})
|
||||||
e = []
|
e = []
|
||||||
@options[:limit] = options[:limit]
|
@options[:limit] = options[:limit]
|
||||||
# modify by nwb
|
# modify by nwb
|
||||||
|
@ -87,7 +87,7 @@ module Redmine
|
||||||
|
|
||||||
@scope.each do |event_type|
|
@scope.each do |event_type|
|
||||||
constantized_providers(event_type).each do |provider|
|
constantized_providers(event_type).each do |provider|
|
||||||
e += provider.find_events(event_type, @user, from, to, @options)
|
e += provider.find_events(event_type, @user, days, created_time, @options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue