diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 66cbf27b8..81d678261 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -29,6 +29,8 @@ class AtController < ApplicationController case type when "Issue" find_issue(id) + whne 'TrainingTask' + find_training_task(id) when 'Project' find_project(id) when 'Course' @@ -69,6 +71,13 @@ class AtController < ApplicationController at_persons.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id } end + def find_training_task(id) + training_task = TrainingTask.find(id) + journals = training_task.journals + at_persons = journals.map(&:user) + training_task.project.users + at_persons.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id } + end + def find_project(id) return [] if id.to_i<0 at_persons = Project.find(id).users diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e91b17212..26137b584 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -379,7 +379,9 @@ class ProjectsController < ApplicationController def settings # 顶部导航 @project_menu_type = 10 - + if @project.is_child_training_project? + return render_404 + end # 修改查看消息状态 applied_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?", User.current.id, @project, "AppliedProject", 0) applied_messages.update_all(:viewed => true) @@ -765,6 +767,14 @@ class ProjectsController < ApplicationController end end + def add_script + if @project.update_attribute(:script, params[:project_script]) + @notice = "脚本添加成功" + else + @notice = "脚本添加失败" + end + end + def modules @project.enabled_module_names = params[:enabled_module_names] flash[:notice] = l(:notice_successful_update) @@ -807,24 +817,33 @@ class ProjectsController < ApplicationController def training_project_execute jobName = "#{@project.id}" - pipeLine = Base64.encode64(@project.script) - params = {:jobName => "#{jobName}", :pipeLine => "#{pipeLine}"} - uri = URI.parse("http://106.75.33.219:9999/jenkins-exec/api/createJob") - begin - respond_message = uri_exec uri, params - @project.update_attribute(:training_status, 1) if respond_message.message - return - rescue - @message = "failure" + pipeLine = "#{Base64.encode64(@project.script)}" + uri = URI("http://123.59.135.74:9999/jenkins-exec/api/createJob") + res = Net::HTTP.post_form(uri, {jobName: jobName, pipeLine: pipeLine}).body + if res.code == 0 + @project.update_attribute(:training_status, 1) + else + flash[:notice] = "启动失败" end end - def training_task_execute - positon = params[:positon].to_i + def training_project_update + jobName = "#{@project.id}" + pipeLine = "#{Base64.encode64(@project.script)}" + uri = URI("http://123.59.135.74:9999/jenkins-exec/api/updateJob") + res = Net::HTTP.post_form(uri, {jobName: jobName, pipeLine: pipeLine}).body + if res.code == 0 + @project.update_attribute(:training_status, 1) + else + flash[:notice] = "启动失败" + end + end + + def task_execute taskId = params[:training_task_id] - jobName = @project.job_name + jobName = @project.forked_from_project_id params = {:jobName => "#{jobName}", :taskId => "#{taskId}"} - uri = URI.parse("http://106.75.33.219:9999/jenkins-exec/api/buildJob") + uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob") begin task = TrainingTask.find(taskId) respond_message = uri_exec uri, params @@ -837,13 +856,22 @@ class ProjectsController < ApplicationController end def uri_exec uri, params - res = Net::HTTP.post_form(uri, params) - res.body + Net::HTTP.post_form(uri, {jobName: '222e', pipeLine: base64}).body + + res = Net::HTTP.post_form(uri, params).body + end + + # 需要传Jobname(项目ID),Task ID, Stage + def training_task_status + task_id = params[:task_id] + stage = params[:stage].to_i + training_task = TrainingTask.find(task_id) + training_task.update_attribute(:status => stage) + end # 资源库fork弹框 def forked_pop - @task = params[:task] respond_to do |format| format.js end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e279e46bd..50dbaec4d 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -148,12 +148,12 @@ class RepositoriesController < ApplicationController s = Trustie::Gitlab::Sync.new s.sync_user(User.current) ensure - logger.error "Synv user failed ==>#{User.current.id}" + logger.error "Syn user failed ==>#{User.current.id}" end end gproject = g.fork(@project.gpid, User.current.gid) if gproject - new_training_project = copy_project(@project, gproject) + new_training_project = copu_project_and_module(@project, gproject) forked_count = @project.forked_count.to_i + 1 @project.update_attributes(:forked_count => forked_count) # 发布实训任务,只发布实训任务的第一个 @@ -163,6 +163,43 @@ class RepositoriesController < ApplicationController end end + def copu_project_and_module tproject, gproject + project = Project.new + project.name = tproject.name + project.is_public = tproject.is_public + project.status = tproject.status + project.description = tproject.description + project.hidden_repo = tproject.hidden_repo + project.user_id = User.current.id + project.project_type = 0 + project.project_new_type = tproject.project_new_type + project.gpid = gproject.id + project.forked_from_project_id = tproject.id + project.enabled_module_names = tproject.enabled_module_names + if project.save + project.update_attribute(:training_status,1) + 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]) + if ProjectScore.where("project_id=?", project.id).first.nil? + ProjectScore.create(:project_id => project.id, :score => false) + end + project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => project.id) + user_grades = UserGrade.create(:user_id => User.current.id, :project_id => project.id) + Rails.logger.debug "UserGrade created: #{user_grades.to_json}" + project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type,:grade => 0) + Rails.logger.debug "ProjectStatus created: #{project_status.to_json}" + project.members << m + project.project_infos << project_info + copy_repository(project, gproject) + return project + else + respond_to do |format| + format.html { render :action => 'forked', :layout => 'base_projects'} + format.api { render_validation_errors(@project) } + end + end + end + # REDO: 如果实训项目还没有创建任务的时候应该跳出 def publish_training_tasks original_project, new_training_project original_task = TrainingTask.where(:project_id => original_project.id, :position => 1).first @@ -221,19 +258,19 @@ class RepositoriesController < ApplicationController project.members << m project.project_infos << project_info copy_repository(project, gproject) - # respond_to do |format| - # format.html { - # flash[:notice] = l(:notice_successful_create) - # if params[:continue] - # attrs = {:parent_id => project.parent_id}.reject {|k,v| v.nil?} - # redirect_to new_project_url(attrs, :course => '0') - # else - # redirect_to project_path(project) - # end - # } - # format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) } - # format.js - # end + respond_to do |format| + format.html { + flash[:notice] = l(:notice_successful_create) + if params[:continue] + attrs = {:parent_id => project.parent_id}.reject {|k,v| v.nil?} + redirect_to new_project_url(attrs, :course => '0') + else + redirect_to project_path(project) + end + } + format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) } + format.js + end return project else respond_to do |format| diff --git a/app/controllers/training_tasks_controller.rb b/app/controllers/training_tasks_controller.rb index 9c84b08f8..1cf775da2 100644 --- a/app/controllers/training_tasks_controller.rb +++ b/app/controllers/training_tasks_controller.rb @@ -59,7 +59,7 @@ class TrainingTasksController < ApplicationController def index # 顶部导航 @project_menu_type = 11 - @training_tasks = TrainingTask.where(:project_id => @project.id).order('updated_at desc') + @training_tasks = TrainingTask.where(:project_id => @project.id).order('position desc') @training_tasks_count = @training_tasks.count @limit = 10 @is_remote = true @@ -88,6 +88,7 @@ class TrainingTasksController < ApplicationController @journal = Journal.new(:journalized => @training_task) respond_to do |format| format.html + format.js end end @@ -358,19 +359,19 @@ class TrainingTasksController < ApplicationController jour = Journal.new jour.user_id = User.current.id jour.notes = params[:notes] - jour.journalized = @issue + jour.journalized = @training_task jour.save_attachments(params[:attachments]) jour.save - update_user_activity(@issue.class,@issue.id) - update_forge_activity(@issue.class,@issue.id) - @allowed_statuses = @issue.new_statuses_allowed_to(User.current) + update_user_activity(@training_task.class, @training_task.id) + update_forge_activity(@training_task.class, @training_task.id) + # @allowed_statuses = @training_task.new_statuses_allowed_to(User.current) @user_activity_id = params[:user_activity_id] @priorities = IssuePriority.active respond_to do |format| # Issue详情单独处理 if params[:is_issue_show] - format.js{redirect_to issue_path(@issue)} + format.js{ redirect_to training_task_path(@training_task) } else format.js end @@ -397,7 +398,7 @@ class TrainingTasksController < ApplicationController #对某个journ回复,显示回复框 def reply - @issue = Issue.find(params[:id]) + @training_task = TrainingTask.find(params[:id]) @jour = Journal.find(params[:journal_id]) respond_to do |format| format.js @@ -408,25 +409,25 @@ class TrainingTasksController < ApplicationController def add_reply if User.current.logged? jour = Journal.find(params[:journal_id]) - @issue = Issue.find params[:id] - @project = @issue.project - @allowed_statuses = @issue.new_statuses_allowed_to(User.current) + @training_task = TrainingTask.find params[:id] + @project = @training_task.project + @allowed_statuses = @training_task.new_statuses_allowed_to(User.current) @priorities = IssuePriority.active new_jour = Journal.new new_jour.user_id = User.current.id new_jour.reply_id = params[:journal_id] new_jour.parent_id = jour.id new_jour.notes = params[:content] - new_jour.journalized = @issue + new_jour.journalized = @training_task new_jour.save_attachments(params[:attachments]) # new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id) @user_activity_id = params[:user_activity_id] if new_jour.save - update_user_activity(@issue.class,@issue.id) - update_forge_activity(@issue.class,@issue.id) + update_user_activity(@training_task.class,@issue.id) + update_forge_activity(@training_task.class,@issue.id) respond_to do |format| if params[:is_issue_show] - format.js{redirect_to issue_path(@issue)} + format.js{ redirect_to project_training_task_path(@training_task) } else format.js end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index c87cdcca5..a7fef3dd7 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -544,7 +544,7 @@ module ProjectsHelper result = "manage_versions" elsif user.allowed_to?(:manage_repository, @project) result = "manage_repository" - elsif user.admin? + elsif is_project_manager?(user.id, @project.id) result = "training_task" end result diff --git a/app/helpers/training_tasks_helper.rb b/app/helpers/training_tasks_helper.rb index 4096b1cb0..bb52e8a79 100644 --- a/app/helpers/training_tasks_helper.rb +++ b/app/helpers/training_tasks_helper.rb @@ -1,2 +1,44 @@ module TrainingTasksHelper + include ApplicationHelper + include TagsHelper + require 'iconv' + + # Returns the textual representation of a journal details + # as an array of strings + def details_to_strings(details, no_html=false, options={}) + options[:only_path] = (options[:only_path] == false ? false : true) + options[:token] = options[:token] if options[:token] + strings = [] + values_by_field = {} + details.each do |detail| + + if detail.property == 'cf' + field_id = detail.prop_key + field = CustomField.find_by_id(field_id) + if field && field.multiple? + values_by_field[field_id] ||= {:added => [], :deleted => []} + if detail.old_value + values_by_field[field_id][:deleted] << detail.old_value + end + if detail.value + values_by_field[field_id][:added] << detail.value + end + next + end + end + strings << show_detail(detail, no_html, options) + + end + values_by_field.each do |field_id, changes| + detail = JournalDetail.new(:property => 'cf', :prop_key => field_id) + if changes[:added].any? + detail.value = changes[:added] + strings << show_detail(detail, no_html, options) + elsif changes[:deleted].any? + detail.old_value = changes[:deleted] + strings << show_detail(detail, no_html, options) + end + end + strings + end end diff --git a/app/models/journal.rb b/app/models/journal.rb index f14484a31..822d7beca 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -23,7 +23,8 @@ class Journal < ActiveRecord::Base belongs_to :journalized, :polymorphic => true,:touch => true # added as a quick fix to allow eager loading of the polymorphic association # since always associated to an issue, for now - belongs_to :issue, :foreign_key => :journalized_id,:touch => true + belongs_to :issue, :foreign_key => :journalized_id, :touch => true + belongs_to :training_task, :foreign_key => :journalized_id, :touch => true belongs_to :user has_many :details, :class_name => "JournalDetail", :dependent => :delete_all @@ -192,27 +193,44 @@ class Journal < ActiveRecord::Base def act_as_forge_message receivers = [] # 直接回复 - if self.user_id != self.issue.author_id - receivers << self.issue.author_id - end - if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送 - receivers << self.issue.assigned_to_id - end - receivers.each do |r| - self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false) + if self.journalized_type == 'Issue' + if self.user_id != self.issue.author_id + receivers << self.issue.author_id + end + if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送 + receivers << self.issue.assigned_to_id + end + receivers.each do |r| + self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false) + end + elsif self.journalized_type == 'TrainingTask' + if self.user_id != self.training_task.author_id + receivers << self.training_task.author_id + end + receivers.each do |r| + self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.training_task.project, :viewed => false) + end end end # 更新用户分数 -by zjc def be_user_score + if (self.journalized_type == 'Issue') #新建了缺陷留言且留言不为空,不为空白 - if !self.notes.nil? && self.notes.gsub(' ','') != '' - #协同得分加分 - UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id }) - update_messges_for_issue(self.user,1) - update_messges_for_issue(self.user,2,self.issue.project) + if !self.notes.nil? && self.notes.gsub(' ','') != '' + #协同得分加分 + UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id }) + update_messges_for_issue(self.user,1) + update_messges_for_issue(self.user,2,self.issue.project) + end + elsif( self.journalized_type == 'TrainingTask') + if !self.notes.nil? && self.notes.gsub(' ','') != '' + #协同得分加分 + UserScore.joint(:post_issue_message, self.user, self.training_task.author, self, { message_id: self.id }) + update_messges_for_issue(self.user, 1) + update_messges_for_issue(self.user, 2, self.training_task.project) + end end - end # 减少用户分数 -by zjc def down_user_score @@ -237,12 +255,18 @@ class Journal < ActiveRecord::Base # issue留言总数更新 def add_journals_count - if !self.issue.project.nil? && self.journalized_type == "Issue" && !self.issue.project.project_score.nil? - project = self.issue.project - project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1) + if self.journalized_type == 'Issue' + if !self.issue.project.nil? && self.journalized_type == "Issue" && !self.issue.project.project_score.nil? + project = self.issue.project + project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1) + end + elsif self.journalized_type == 'TrainingTask' + if !self.training_task.project.nil? && self.journalized_type == "TrainingTask" && !self.training_task.project.project_score.nil? + project = self.training_task.project + project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1) + end end end - # 回复issue的时候,更新issue的时候 def update_issue_time if self.journalized_type == "Issue" diff --git a/app/models/project.rb b/app/models/project.rb index 1421ebc8e..cd8ea3d7b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -160,6 +160,7 @@ class Project < ActiveRecord::Base after_create :create_board_sync,:acts_as_forge_activities, :create_project_ealasticsearch_index before_destroy :delete_all_members,:delete_project_ealasticsearch_index after_update :update_project_ealasticsearch_index + def remove_references_before_destroy return if self.id.nil? Watcher.delete_all ['watchable_id = ?', id] @@ -194,6 +195,7 @@ class Project < ActiveRecord::Base scope :project_entities, -> { where(project_type: ProjectType_project) } scope :course_entities, -> { where(project_type: ProjectType_course) } scope :indexable,lambda { where('is_public = 1')} #用于elastic建索引的scope + def self.search(query) __elasticsearch__.search( { @@ -220,6 +222,17 @@ class Project < ActiveRecord::Base } ) end + + # 判断项目是否为实训项目 + def is_training_project? + (self.enabled_modules.where("name = 'training_tasks'").empty? && self.training_status == 0) ? false : true + end + + # 判断项目是否为开启实训的项目(eg:学生开启实训) + def is_child_training_project? + self.training_status == 1 ? true :false + end + def new_course self.where('project_type = ?', 1) end diff --git a/app/views/layouts/_base_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb index 0c59da6cf..6d26bc124 100644 --- a/app/views/layouts/_base_project_top.html.erb +++ b/app/views/layouts/_base_project_top.html.erb @@ -15,9 +15,12 @@ -
- -
+ <% if true %> +
+ +
+ <% end %> +
<% unless @project.forked_from_project_id.nil? %>
@@ -40,8 +43,8 @@ <% end %> <% unless @project.enabled_modules.where("name = 'training_tasks'").empty? %> -
  • - <%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}#{switch_integer_into_k training_tasks_count}".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project, :remote => true), :class => "pro_new_proname", :title => "#{training_tasks_count}" %> +
  • + <%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}#{switch_integer_into_k training_tasks_count}".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
  • <% end %> @@ -87,7 +90,7 @@ <% end %> - <% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %> + <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && !@project.is_child_training_project? %>
  • <%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
  • diff --git a/app/views/praise_tread/_praise.html.erb b/app/views/praise_tread/_praise.html.erb index dfd1011db..223cc9c5e 100644 --- a/app/views/praise_tread/_praise.html.erb +++ b/app/views/praise_tread/_praise.html.erb @@ -1,11 +1,23 @@ <% if PraiseTread.praised(activity) %> - + <% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %> <%= (num.nil? ? 0 : num) > 0 ? "(#{(num.nil? ? 0 : num)})" : "" %> <% else %> - + 已赞 <% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %> <%= (num.nil? ? 0 : num) > 0 ? "(#{(num.nil? ? 0 : num)})" : "" %> diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb index d86acac32..a528d8f20 100644 --- a/app/views/projects/_applied_status.html.erb +++ b/app/views/projects/_applied_status.html.erb @@ -36,7 +36,7 @@
  • - <% if !@project.enabled_modules.where("name = 'training_tasks'").empty? && @project.forked_from_project_id.nil? %> + <% if @project.is_training_project? %> <%= link_to "开始实训", forked_pop_project_path(@project, :task => true), :class => "sy_btn_green fr", :remote => true %> <% else %> <%= link_to "".html_safe+"Fork", forked_pop_project_path(@project), diff --git a/app/views/projects/_invite_code.html.erb b/app/views/projects/_invite_code.html.erb index 94a2d1ea5..03591034a 100644 --- a/app/views/projects/_invite_code.html.erb +++ b/app/views/projects/_invite_code.html.erb @@ -1,5 +1,5 @@

    项目简介 -<% if User.current.member_of?(@project) %> +<% if User.current.member_of?(@project) && !@project.is_child_training_project? %> 邀请码:<%= @project.invite_code %> <% end %>

    \ No newline at end of file diff --git a/app/views/projects/add_script.js.erb b/app/views/projects/add_script.js.erb new file mode 100644 index 000000000..f4473a7da --- /dev/null +++ b/app/views/projects/add_script.js.erb @@ -0,0 +1 @@ +$("#training_project_exec_tip").html('<%= escape_javascript( render :partial => 'projects/settings/training_project_exec_tip') %>'); \ No newline at end of file diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb index 6685f1e4f..21f5e2ecd 100644 --- a/app/views/projects/settings.html.erb +++ b/app/views/projects/settings.html.erb @@ -55,7 +55,7 @@
  • - <%= render :partial=>"projects/settings/new_trainig_task" if User.current.admin? %> + <%= render :partial=>"projects/settings/new_trainig_task" if is_project_manager?(User.current.id, @project.id) %>
    diff --git a/app/views/projects/settings/_new_trainig_task.html.erb b/app/views/projects/settings/_new_trainig_task.html.erb index e92c42006..223f0b84d 100644 --- a/app/views/projects/settings/_new_trainig_task.html.erb +++ b/app/views/projects/settings/_new_trainig_task.html.erb @@ -1,26 +1,47 @@ -

    提示文字

    +
    + <%= render :partial => "projects/settings/training_project_exec_tip" %> +
    +
    - 开启实训 +
    + <%= render :partial => "projects/settings/training_projects_filter_tip" %> +
    +
    + +
    - - 取消 - 确定 + <%= form_tag(url_for(:controller => 'projects', :action => 'add_script', :project_id => @project.id), :id => 'project_script_form', :method => "post", :remote => true) do %> + + + 取消 + 确定 + <% end %>
    -
    -

    请输入脚本

    -

    <%= link_to "开启实训", training_project_execute_project_path(@project) %>

    - - \ No newline at end of file + //提交pull request_comment + function project_script_commit() + { + if(regex_pr_comment()) + { + $("#project_script_form").submit(); + } + } + diff --git a/app/views/projects/settings/_training_project_exec_tip.html.erb b/app/views/projects/settings/_training_project_exec_tip.html.erb new file mode 100644 index 000000000..3445f4c9b --- /dev/null +++ b/app/views/projects/settings/_training_project_exec_tip.html.erb @@ -0,0 +1,3 @@ +<% if @notice %> +

    <%= @notice %>

    +<% end %> diff --git a/app/views/projects/settings/_training_projects_filter_tip.html.erb b/app/views/projects/settings/_training_projects_filter_tip.html.erb new file mode 100644 index 000000000..e930bc4c7 --- /dev/null +++ b/app/views/projects/settings/_training_projects_filter_tip.html.erb @@ -0,0 +1,5 @@ +<% if @project.training_status == 1 %> + <%= link_to "重启实训", training_project_update_project_path, :class => "fr sy_btn_green mb10", :remote => true %> +<% else %> + <%= link_to "开启实训", training_project_execute_project_path, :class => "fr sy_btn_green mb10", :remote => true %> +<% end %> \ No newline at end of file diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 85dda34af..24b982b77 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,6 +1,6 @@
    -
    <%= render :partial => 'projects/invite_code' %>
    +
    <%= render :partial => 'projects/invite_code' %>
    <% if @project.description.blank? %>

    <%= @project.name %>

    diff --git a/app/views/projects/training_project_execute.js.erb b/app/views/projects/training_project_execute.js.erb new file mode 100644 index 000000000..5e1b2630c --- /dev/null +++ b/app/views/projects/training_project_execute.js.erb @@ -0,0 +1,2 @@ +$("#training_project_exec_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_project_exec_tip') %>'); +$("#training_project_filter_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_projects_filter_tip') %>'); \ No newline at end of file diff --git a/app/views/repositories/_forked_popbox.html.erb b/app/views/repositories/_forked_popbox.html.erb index 54426bd0d..8bd663cec 100644 --- a/app/views/repositories/_forked_popbox.html.erb +++ b/app/views/repositories/_forked_popbox.html.erb @@ -7,7 +7,7 @@
      <%# 实训项目和非实训项目,@type为true的时候为实训 %> - <% if @task %> + <% if @project.is_training_project? %> <% if User.current.id == @project.user_id %>
    • 很抱歉,您不能在自己的实训项目中启动训练 diff --git a/app/views/training_tasks/_all_list.html.erb b/app/views/training_tasks/_all_list.html.erb index 501c25514..59549283d 100644 --- a/app/views/training_tasks/_all_list.html.erb +++ b/app/views/training_tasks/_all_list.html.erb @@ -1,12 +1,3 @@ <% tasks.each do |task| -%> <%= render :partial => 'content_list', :locals => {:activity => task, :user_activity_id => task.id} %> -<% end %> - -
      -
      -
        - <%= pagination_links_full @training_tasks_pages, @training_tasks_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> -
      -
      -
      -
      \ No newline at end of file +<% end %> \ No newline at end of file diff --git a/app/views/training_tasks/_content_list.html.erb b/app/views/training_tasks/_content_list.html.erb index e7e2b5124..9af990c08 100644 --- a/app/views/training_tasks/_content_list.html.erb +++ b/app/views/training_tasks/_content_list.html.erb @@ -1,49 +1,38 @@ <% unless activity.author.nil? %> -
      -
      - -
      -
      -
      - <%= activity.subject.to_s %> -
      + + + <% if activity.status == 0 %> +
      + <% elsif activity.status == 1 %> +
      + <% end %> +
      +
      + + step<%= activity.position %> + <%= activity.subject.to_s %> + + <% if activity.status == 0 %> + 正在解决中 + <% end %> +
      +
      +
      +

      <%= format_time(activity.created_at) %>发布

      +

      <%= format_time(activity.updated_at) %>更新

      +
      -
      - <%# if activity.try(:author).try(:realname) == ' ' %> - <%#= link_to activity.try(:author), user_path(activity.author_id), :class => "fl issues_list_name" %> - <%# else %> - <%#= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "fl issues_list_name" %> - <%# end %> - -

      <%= format_time(activity.created_at) %> 发布

      -

      <%= format_time(activity.updated_at) %> 更新

      -
      -
      -
        -
      • - <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id)%> - <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id)%> - <% end %> -
      • - -
      • - <% case activity.tracker_id %> - <% when 1%> - 缺陷 - <% when 2%> - 功能 - <% when 3%> - 支持 - <% when 4%> - 任务 - <% when 5%> - 周报 - <% end %> -
      • -
      -
      + + + <% if activity.journals.count != 0 %> + + <%= activity.journals.count %> + <% end %> + + + <%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "btn btn-blue", :remote => true %> + + <% end %> -
    • +
    • <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
      -
      +
      <%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'Issue', :user_activity_id => issue.id}%>
      @@ -28,44 +28,49 @@ <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> - <%= link_to( - l(:button_reply), - {:controller => 'issues', :action => 'reply', :user_id => comment.user_id, :id => issue.id, :journal_id => comment.id}, - :remote => true, - :method => 'get', - :title => l(:button_reply)) %> + <%= link_to(l(:button_reply), + {:controller => 'training_tasks', + :action => 'reply', + :user_id => comment.user_id, + :id => @training_task.id, + :journal_id => comment.id}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> - <%= link_to( - l(:button_delete), - {:controller => 'issues',:action => 'delete_journal', :id => issue.id, :journal_id=>comment.id}, - :method => :get, - :remote => true, - :id => "delete_reply_#{comment.id}", - :class => 'fr mr20 undis', - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) + <%= link_to(l(:button_delete), + {:controller => 'training_tasks', + :action => 'delete_journal', + :id => @training_task.id, + :journal_id=>comment.id}, + :method => :get, + :remote => true, + :id => "delete_reply_#{comment.id}", + :class => 'fr mr20 undis', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete) ) if comment.user_id == User.current.id %>
      -

      +

    • <% end %>
    -
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@training_task.author_id), :alt => "用户头像" %>
    -
    +
    <% if User.current.logged? %>
    - <%= form_for('new_form', :url => add_journal_issue_path(@training_task.id, :is_issue_show => true), :method => "post", :remote => true) do |f| %> + <%= form_for('new_form', :url => add_journal_project_training_task_path(@training_task.id, :is_issue_show => true), :method => "post", :remote => true) do |f| %>
    diff --git a/app/views/training_tasks/_reply_banner.html.erb b/app/views/training_tasks/_reply_banner.html.erb index 9bbd17831..0cd357b65 100644 --- a/app/views/training_tasks/_reply_banner.html.erb +++ b/app/views/training_tasks/_reply_banner.html.erb @@ -1,5 +1,6 @@ <% count = @training_task.journals.count %> -回复<%= count>0 ? "(#{count})" : "" %> +回复<%= count > 0 ? "(#{count})" : "" %> + - <%=render :partial=> "praise_tread/praise", :locals => {:activity => @training_task, :user_activity_id=> @training_task.id, :type => "activity"}%> + <%=render :partial => "praise_tread/praise", :locals => {:activity => @training_task, :user_activity_id => @training_task.id, :type => "activity"}%> \ No newline at end of file diff --git a/app/views/training_tasks/_task_attachments.html.erb b/app/views/training_tasks/_task_attachments.html.erb index c47ac4c92..3036a625a 100644 --- a/app/views/training_tasks/_task_attachments.html.erb +++ b/app/views/training_tasks/_task_attachments.html.erb @@ -1,4 +1,4 @@ -<% if training_task.attachments.any? %> +<% if training_task.attachments.any? %>
    diff --git a/app/views/training_tasks/_training_tasks_reply_ke_form.html.erb b/app/views/training_tasks/_training_tasks_reply_ke_form.html.erb new file mode 100644 index 000000000..6e76e8c30 --- /dev/null +++ b/app/views/training_tasks/_training_tasks_reply_ke_form.html.erb @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/app/views/training_tasks/add_journal.js.erb b/app/views/training_tasks/add_journal.js.erb new file mode 100644 index 000000000..d3f5a12fa --- /dev/null +++ b/app/views/training_tasks/add_journal.js.erb @@ -0,0 +1 @@ + diff --git a/app/views/training_tasks/index.html.erb b/app/views/training_tasks/index.html.erb index 978c17a07..ea5bf3d58 100644 --- a/app/views/training_tasks/index.html.erb +++ b/app/views/training_tasks/index.html.erb @@ -202,6 +202,57 @@ } + +
    + <% if !@project.is_child_training_project? || User.current.admin? %> + 新建 +
    + <% else %> +
    +

    完成任务后,请点击“提交评测”按钮,若通过系统测试,将为你发送下一个任务,祝你早日通关,加油!

    +
    + <% end %> + <% if @training_tasks.empty? %> + <%= render :partial => "projects/no_data" %> + <% else %> +
    +
    + + + + + + + + + + <%= render :partial => 'all_list', :locals => {:tasks => @training_tasks} %> + +

    所有<%= @training_tasks_count %>

      
    +
    +
    +
      + +
    +
    +
    +
      + <%= pagination_links_full @training_tasks_pages, @training_tasks_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    +
    +
    +
    +
    + <% end %> +
    + + + + + + +<% if false %>
    @@ -230,3 +281,4 @@
    +<% end %> \ No newline at end of file diff --git a/app/views/training_tasks/index.js.erb b/app/views/training_tasks/index.js.erb new file mode 100644 index 000000000..d0ac3f0a6 --- /dev/null +++ b/app/views/training_tasks/index.js.erb @@ -0,0 +1,3 @@ +$("#issue_list").html("<%= escape_javascript(render :partial => 'training_tasks/all_list',:locals => {:tasks => @training_tasks, :project=> @project})%>"); +$("#issue_list_pagination").html('<%= pagination_links_full @training_tasks_pages, @training_tasks_count, :training_tasks => @training_tasks, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>'); + diff --git a/app/views/training_tasks/reply.js.erb b/app/views/training_tasks/reply.js.erb new file mode 100644 index 000000000..3c7acd927 --- /dev/null +++ b/app/views/training_tasks/reply.js.erb @@ -0,0 +1,8 @@ +if($("#reply_message_<%= @jour.id %>").length > 0) { + $("#reply_message_<%= @jour.id %>").replaceWith("<%= escape_javascript(render :partial => 'training_tasks/training_tasks_reply_ke_form') %>"); + $(function(){ + sd_create_editor_from_data(<%= @jour.id %>, null, "100%", "<%= @jour.class.name %>"); + }); +}else if($("#reply_to_message_<%= @jour.id %>").length >0) { + $("#reply_to_message_<%= @jour.id %>").replaceWith("

    "); +} \ No newline at end of file diff --git a/app/views/training_tasks/show.html.erb b/app/views/training_tasks/show.html.erb index bf4afb093..f125717b1 100644 --- a/app/views/training_tasks/show.html.erb +++ b/app/views/training_tasks/show.html.erb @@ -3,16 +3,16 @@ <%= javascript_include_tag 'create_kindeditor'%> <% end %>
    -
    +
    @@ -22,16 +22,16 @@
    -
    -
    -
    -
    - <%=render :partial => 'reply_banner' %> +
    +
    +
    +
    + <%= render :partial => 'reply_banner' %>
    - <%= render :partial => 'issue_replies',:locals => {:issue => @training_task, :replies_all_i => 0} %> + <%= render :partial => 'issue_replies',:locals => {:issue => @training_task, :replies_all_i => 0 } %>
    diff --git a/app/views/training_tasks/show.js.erb b/app/views/training_tasks/show.js.erb new file mode 100644 index 000000000..a465dab32 --- /dev/null +++ b/app/views/training_tasks/show.js.erb @@ -0,0 +1,19 @@ +// $("#div_user_issue_reply_<%#= @user_activity_id %>").html("<%#= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); + +$("#reply_div_<%= @training_task.id %>").html("<%= escape_javascript(render :partial => 'training_tasks/issue_replies', :locals => {:issue => @training_task}) %>"); +$("#div_issue_attachment_<%=@training_task.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @training_task}) %>"); +issue_desc_editor = KindEditor.create('#issue_description', + {"width":"85%", + "resizeType":0, + "no_label":true, + "at_id":<%= @training_task.project_id%>, + "at_type":"Project", + "autoHeightMode":true, + "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%= @training_task.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})", + "emotionsBasePath":'<%= Setting.host_name%>', + "height":300, + "allowFileManager":true, + "uploadJson":"/kindeditor/upload", + "fileManagerJson":"/kindeditor/filemanager"}); +$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'reply_banner') %>'); +sd_create_editor_from_data(<%= @training_task.id %>, null, "100%", "<%= @training_task.class.name %>"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 8548dc665..a0ee7ea2b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -906,12 +906,15 @@ RedmineApp::Application.routes.draw do match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #end + post 'add_script' post 'modules' post 'archive' post 'unarchive' post 'close' post 'reopen' get 'training_project_execute' + get 'training_project_update' + get 'task_execute' get 'forked_pop' get 'delete_member_pop', :to => 'projects#delete_member_pop', :via => :get, :as => "delete_member_pop" get 'search_public_orgs_not_in_project' @@ -922,6 +925,7 @@ RedmineApp::Application.routes.draw do collection do get 'project_home' match 'join_project', :via => [:get, :post] + match 'training_task_status', :via => [:get, :post] end #by young @@ -1099,6 +1103,11 @@ RedmineApp::Application.routes.draw do post 'complete_training_task' end collection do + post 'add_journal' + post 'add_journal_in_org' + get 'delete_journal' + get 'reply' + post 'add_reply' end end diff --git a/db/schema.rb b/db/schema.rb index 5e041a681..17dd60485 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20170219070127) do +ActiveRecord::Schema.define(:version => 20170219025424) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -305,17 +305,18 @@ ActiveRecord::Schema.define(:version => 20170219070127) do end create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false t.integer "last_message_id" t.integer "parent_id" t.integer "course_id" t.integer "org_subfield_id" t.integer "contest_id" + t.integer "training_project_id" end add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" @@ -713,8 +714,8 @@ ActiveRecord::Schema.define(:version => 20170219070127) do t.string "code" t.integer "time" t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "location" t.string "term" t.string "string" @@ -724,28 +725,29 @@ ActiveRecord::Schema.define(:version => 20170219070127) do t.string "class_period" t.integer "school_id" t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 t.integer "lft" t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "is_delete", :default => 0 + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "is_delete", :default => 0 t.integer "end_time" t.string "end_term" - t.integer "is_excellent", :default => 0 - t.integer "excellent_option", :default => 0 - t.integer "is_copy", :default => 0 - t.integer "visits", :default => 0 + t.integer "is_excellent", :default => 0 + t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 + t.integer "visits", :default => 0 t.integer "syllabus_id" t.string "invite_code" t.string "qrcode" - t.integer "qrcode_expiretime", :default => 0 - t.integer "invite_code_halt", :limit => 1, :default => 0 - t.integer "os_allow", :default => 0 + t.integer "qrcode_expiretime", :default => 0 + t.integer "professional_level_id", :limit => 1 + t.integer "invite_code_halt", :limit => 1, :default => 0 + t.integer "os_allow", :default => 0 end add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true @@ -820,19 +822,9 @@ ActiveRecord::Schema.define(:version => 20170219070127) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "delayed_jobs_20161218", :id => false, :force => true do |t| - t.integer "id", :default => 0, :null => false - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" + create_table "disciplines", :force => true do |t| + t.string "name" + t.integer "professional_level_id", :limit => 1 end create_table "discuss_demos", :force => true do |t| @@ -987,8 +979,9 @@ ActiveRecord::Schema.define(:version => 20170219070127) do t.integer "forge_act_id" t.string "forge_act_type" t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "training_project_id" end add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" @@ -1690,9 +1683,12 @@ ActiveRecord::Schema.define(:version => 20170219070127) do end create_table "professional_levels", :force => true do |t| - t.string "level" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "level" + end + + create_table "professions", :force => true do |t| + t.string "name" + t.integer "discipline_id", :limit => 1 end create_table "project_infos", :force => true do |t| @@ -1705,18 +1701,19 @@ ActiveRecord::Schema.define(:version => 20170219070127) do create_table "project_scores", :force => true do |t| t.string "project_id" t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - t.integer "board_num", :default => 0 - t.integer "attach_num", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + t.integer "board_num", :default => 0 + t.integer "attach_num", :default => 0 t.datetime "commit_time" - t.integer "pull_request_num", :default => 0 + t.integer "pull_request_num", :default => 0 + t.integer "training_project_id", :default => -1 end create_table "project_statuses", :force => true do |t| @@ -1739,37 +1736,40 @@ ActiveRecord::Schema.define(:version => 20170219070127) do end create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false + t.string "name", :default => "", :null => false t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false t.integer "parent_id" t.datetime "created_on" t.datetime "updated_on" t.string "identifier" - t.integer "status", :default => 1, :null => false + t.integer "status", :default => 1, :null => false t.integer "lft" t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false + t.boolean "inherit_members", :default => false, :null => false t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 t.integer "user_id" - t.integer "dts_test", :default => 0 t.string "enterprise_name" t.integer "organization_id" t.integer "project_new_type" t.integer "gpid" t.integer "forked_from_project_id" t.integer "forked_count" - t.integer "publish_resource", :default => 0 - t.integer "visits", :default => 0 - t.integer "hot", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "boards_count", :default => 0 + t.integer "news_count", :default => 0 + t.integer "acts_count", :default => 0 + t.integer "journals_count", :default => 0 + t.integer "boards_reply_count", :default => 0 + t.integer "visits", :default => 0 + t.integer "hot", :default => 0 t.string "invite_code" t.string "qrcode" - t.integer "qrcode_expiretime", :default => 0 + t.integer "qrcode_expiretime", :default => 0 t.text "script" - t.integer "training_status", :limit => 1, :default => 0 end add_index "projects", ["lft"], :name => "index_projects_on_lft" @@ -2163,8 +2163,8 @@ ActiveRecord::Schema.define(:version => 20170219070127) do t.string "title" t.text "description" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "eng_name" t.integer "syllabus_type" t.integer "credit" @@ -2173,8 +2173,9 @@ ActiveRecord::Schema.define(:version => 20170219070127) do t.integer "practice_hours" t.string "applicable_major" t.string "pre_course" - t.integer "visits", :default => 0 - t.integer "des_status", :default => 0 + t.integer "visits", :default => 0 + t.integer "des_status", :default => 0 + t.integer "professional_level_id", :limit => 1 end add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" @@ -2255,6 +2256,46 @@ ActiveRecord::Schema.define(:version => 20170219070127) do t.integer "fields_bits", :default => 0 end + create_table "trackers_training_projects", :id => false, :force => true do |t| + t.integer "training_project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "trackers_training_projects", ["training_project_id"], :name => "projects_trackers_training_project_id" + + create_table "training_projects", :force => true do |t| + t.string "name", :limit => 30, :null => false + t.text "description" + t.string "homepage", :limit => 60 + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.integer "projects_count", :default => 0 + t.string "identifier", :null => false + t.integer "status", :default => 1 + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + t.string "enterprise_name" + t.integer "organization_id" + t.integer "project_new_type" + t.integer "gpid" + t.integer "forked_from_project_id" + t.integer "forked_count" + t.integer "publish_resource", :default => 0 + t.integer "visits", :default => 0 + t.integer "hot", :default => 0 + t.string "invite_code" + t.string "qrcode" + t.integer "qrcode_expiretime", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "training_tasks", :force => true do |t| t.integer "project_id" t.integer "tracker_id" @@ -2264,7 +2305,6 @@ ActiveRecord::Schema.define(:version => 20170219070127) do t.datetime "updated_at", :null => false t.integer "author_id" t.integer "status", :limit => 1, :default => 0 - t.integer "position", :limit => 1 end create_table "user_actions", :force => true do |t|