fix the projects's present bug
This commit is contained in:
parent
2768c935be
commit
45178e178f
|
@ -170,7 +170,7 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
@projects = []
|
@projects = []
|
||||||
@projects_status.each do |obj|
|
@projects_status.each do |obj|
|
||||||
@projects << Project.find_by_id("#{obj.project_id}")
|
@projects << Project.visible.find_by_id("#{obj.project_id}") unless Project.visible.find_by_id("#{obj.project_id}").nil?
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -289,7 +289,9 @@ class ProjectsController < ApplicationController
|
||||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||||
m = Member.new(:user => User.current, :roles => [r])
|
m = Member.new(:user => User.current, :roles => [r])
|
||||||
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||||
project_status = ProjectStatus.create(:project_id => @project.id)
|
if params[:project][:is_public] == 1
|
||||||
|
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0)
|
||||||
|
end
|
||||||
@project.members << m
|
@project.members << m
|
||||||
@project.project_infos << project
|
@project.project_infos << project
|
||||||
end
|
end
|
||||||
|
@ -446,6 +448,14 @@ class ProjectsController < ApplicationController
|
||||||
@project.safe_attributes = params[:project]
|
@project.safe_attributes = params[:project]
|
||||||
if validate_parent_id && @project.save
|
if validate_parent_id && @project.save
|
||||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||||
|
|
||||||
|
if params[:project][:is_public] == '0'
|
||||||
|
project_status = ProjectStatus.find_by_project_id(@project.id)
|
||||||
|
project_status.destroy
|
||||||
|
elsif params[:project][:is_public] == '1'
|
||||||
|
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0)
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
<%= wikitoolbar_for 'project_description' %>
|
<%= wikitoolbar_for 'project_description' %>
|
||||||
|
|
||||||
|
|
||||||
<% @project.custom_field_values.each do |value| %>
|
<% @project.custom_field_values.each do |value| %>
|
||||||
<p><%= custom_field_tag_with_label :project, value %></p>
|
<p><%= custom_field_tag_with_label :project, value %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %><%= content_tag('span', l(:label_since_last_commits)) %>
|
<%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %><%= content_tag('span', l(:label_since_last_commits)) %>
|
||||||
</p>
|
</p>
|
||||||
<p class="stats">
|
<p class="stats">
|
||||||
<%= content_tag('span', "#{@project.repository.nil? ? '0' : @project.repository.changesets.count }", :class => "info") %><%= content_tag('span', l(:label_commit_on)) %>
|
<%= content_tag('span', "#{@project.repository.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %><%= content_tag('span', l(:label_commit_on)) %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<%= content_tag('span', "#{l(:default_role_manager)}: ") %>
|
<%= content_tag('span', "#{l(:default_role_manager)}: ") %>
|
||||||
<% @admin = @project.project_infos%>
|
<% @admin = @project.project_infos%>
|
||||||
<% if @admin.size > 0 %>
|
<% if @admin.size > 0 %>
|
||||||
<%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
|
<%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="licences">
|
<div class="licences">
|
||||||
|
|
|
@ -15,12 +15,12 @@ production:
|
||||||
|
|
||||||
development:
|
development:
|
||||||
adapter: mysql2
|
adapter: mysql2
|
||||||
database: bitnami_redmine
|
database: redmine
|
||||||
host: 10.0.47.245
|
host: 10.0.47.98
|
||||||
#socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock
|
#socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock
|
||||||
port: 3306
|
port: 3306
|
||||||
username: root
|
username: root
|
||||||
password: "bitnami"
|
password: "1234"
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
|
|
@ -34,7 +34,7 @@ begin
|
||||||
declare v_uid bigint(22);
|
declare v_uid bigint(22);
|
||||||
declare v int(10);
|
declare v int(10);
|
||||||
declare _done TINYINT(1) default 0;
|
declare _done TINYINT(1) default 0;
|
||||||
declare cur_user cursor for select project_id,count(*) from (select project_id,repositories.id from repositories inner join changesets where repositories.id = changesets.repository_id)t group by project_id;
|
declare cur_user cursor for select project_id,count(*) from (select project_id,repositories.id from repositories inner join changesets where repositories.id = changesets.repository_id and project_id in (SELECT `projects`.id FROM `projects` WHERE (((projects.status <> 9) AND (projects.is_public = 1)))))t group by project_id;
|
||||||
declare continue handler for not found set _done = 1;
|
declare continue handler for not found set _done = 1;
|
||||||
open cur_user;
|
open cur_user;
|
||||||
loop_xxx:loop
|
loop_xxx:loop
|
||||||
|
|
126
db/schema.rb
126
db/schema.rb
|
@ -11,15 +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 => 20130911140205) do
|
ActiveRecord::Schema.define(:version => 20130828080407) do
|
||||||
|
|
||||||
create_table "a_user_watchers", :force => true do |t|
|
|
||||||
t.string "name"
|
|
||||||
t.text "description"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
t.integer "member_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -77,7 +69,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "reward"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "bids", :force => true do |t|
|
create_table "bids", :force => true do |t|
|
||||||
|
@ -162,18 +153,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
|
add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
|
||||||
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
|
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
|
||||||
|
|
||||||
create_table "courses", :force => true do |t|
|
|
||||||
t.integer "tea_id"
|
|
||||||
t.string "name"
|
|
||||||
t.integer "state"
|
|
||||||
t.string "code"
|
|
||||||
t.integer "time"
|
|
||||||
t.string "extra"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
t.string "location"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "custom_fields", :force => true do |t|
|
create_table "custom_fields", :force => true do |t|
|
||||||
t.string "type", :limit => 30, :default => "", :null => false
|
t.string "type", :limit => 30, :default => "", :null => false
|
||||||
t.string "name", :limit => 30, :default => "", :null => false
|
t.string "name", :limit => 30, :default => "", :null => false
|
||||||
|
@ -259,11 +238,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
|
|
||||||
add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
|
add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
|
||||||
|
|
||||||
create_table "homework_for_courses", :force => true do |t|
|
|
||||||
t.integer "project_id"
|
|
||||||
t.integer "bid_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "issue_categories", :force => true do |t|
|
create_table "issue_categories", :force => true do |t|
|
||||||
t.integer "project_id", :default => 0, :null => false
|
t.integer "project_id", :default => 0, :null => false
|
||||||
t.string "name", :limit => 30, :default => "", :null => false
|
t.string "name", :limit => 30, :default => "", :null => false
|
||||||
|
@ -274,9 +248,9 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
|
add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
|
||||||
|
|
||||||
create_table "issue_relations", :force => true do |t|
|
create_table "issue_relations", :force => true do |t|
|
||||||
t.integer "issue_from_id", :null => false
|
t.integer "issue_from_id", :null => false
|
||||||
t.integer "issue_to_id", :null => false
|
t.integer "issue_to_id", :null => false
|
||||||
t.string "relation_type", :null => false
|
t.string "relation_type", :default => "", :null => false
|
||||||
t.integer "delay"
|
t.integer "delay"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -418,22 +392,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
|
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
|
||||||
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
||||||
|
|
||||||
create_table "messages_for_bids", :force => true do |t|
|
|
||||||
t.string "message"
|
|
||||||
t.integer "user_id"
|
|
||||||
t.integer "bid_id"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "messages_for_users", :force => true do |t|
|
|
||||||
t.integer "messager_id"
|
|
||||||
t.integer "user_id"
|
|
||||||
t.string "message"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "news", :force => true do |t|
|
create_table "news", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.string "title", :limit => 60, :default => "", :null => false
|
t.string "title", :limit => 60, :default => "", :null => false
|
||||||
|
@ -494,18 +452,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count"
|
|
||||||
add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count"
|
|
||||||
|
|
||||||
create_table "project_tags", :force => true do |t|
|
|
||||||
t.integer "project_id"
|
|
||||||
t.integer "tag_id"
|
|
||||||
t.string "description"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
t.integer "user_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "projects", :force => true do |t|
|
create_table "projects", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
@ -519,7 +465,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
t.integer "lft"
|
t.integer "lft"
|
||||||
t.integer "rgt"
|
t.integer "rgt"
|
||||||
t.boolean "inherit_members", :default => false, :null => false
|
t.boolean "inherit_members", :default => false, :null => false
|
||||||
t.integer "project_type"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||||
|
@ -573,6 +518,26 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
t.string "issues_visibility", :limit => 30, :default => "default", :null => false
|
t.string "issues_visibility", :limit => 30, :default => "default", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "seems_rateable_cached_ratings", :force => true do |t|
|
||||||
|
t.integer "cacheable_id", :limit => 8
|
||||||
|
t.string "cacheable_type"
|
||||||
|
t.float "avg", :null => false
|
||||||
|
t.integer "cnt", :null => false
|
||||||
|
t.string "dimension"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "seems_rateable_rates", :force => true do |t|
|
||||||
|
t.integer "rater_id", :limit => 8
|
||||||
|
t.integer "rateable_id"
|
||||||
|
t.string "rateable_type"
|
||||||
|
t.float "stars", :null => false
|
||||||
|
t.string "dimension"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "settings", :force => true do |t|
|
create_table "settings", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
t.text "value"
|
t.text "value"
|
||||||
|
@ -583,27 +548,13 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
|
|
||||||
create_table "shares", :force => true do |t|
|
create_table "shares", :force => true do |t|
|
||||||
t.date "created_on"
|
t.date "created_on"
|
||||||
t.string "title"
|
|
||||||
t.string "share_type"
|
|
||||||
t.string "url"
|
t.string "url"
|
||||||
t.datetime "created_at", :null => false
|
t.string "title"
|
||||||
t.datetime "updated_at", :null => false
|
t.integer "share_type"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "description"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "students", :force => true do |t|
|
|
||||||
t.string "name"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "students_for_courses", :force => true do |t|
|
|
||||||
t.integer "student_id"
|
|
||||||
t.integer "course_id"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "taggings", :force => true do |t|
|
create_table "taggings", :force => true do |t|
|
||||||
|
@ -623,16 +574,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
t.string "name"
|
t.string "name"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "teachers", :force => true do |t|
|
|
||||||
t.string "tea_name"
|
|
||||||
t.string "location"
|
|
||||||
t.integer "couurse_time"
|
|
||||||
t.integer "course_code"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
t.string "extra"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "time_entries", :force => true do |t|
|
create_table "time_entries", :force => true do |t|
|
||||||
t.integer "project_id", :null => false
|
t.integer "project_id", :null => false
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
|
@ -657,7 +598,7 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
create_table "tokens", :force => true do |t|
|
create_table "tokens", :force => true do |t|
|
||||||
t.integer "user_id", :default => 0, :null => false
|
t.integer "user_id", :default => 0, :null => false
|
||||||
t.string "action", :limit => 30, :default => "", :null => false
|
t.string "action", :limit => 30, :default => "", :null => false
|
||||||
t.string "value", :limit => 40
|
t.string "value", :limit => 40, :default => "", :null => false
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -683,7 +624,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
t.integer "zip_code"
|
t.integer "zip_code"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "identity"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "user_preferences", :force => true do |t|
|
create_table "user_preferences", :force => true do |t|
|
||||||
|
@ -706,14 +646,6 @@ ActiveRecord::Schema.define(:version => 20130911140205) do
|
||||||
add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
|
add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
|
||||||
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
|
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
|
||||||
|
|
||||||
create_table "user_tags", :force => true do |t|
|
|
||||||
t.integer "user_id"
|
|
||||||
t.integer "tag_id"
|
|
||||||
t.string "description"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", :force => true do |t|
|
||||||
t.string "login", :default => "", :null => false
|
t.string "login", :default => "", :null => false
|
||||||
t.string "hashed_password", :limit => 40, :default => "", :null => false
|
t.string "hashed_password", :limit => 40, :default => "", :null => false
|
||||||
|
|
Loading…
Reference in New Issue