Merge branch 'dev_raining' of https://git.trustie.net/jacknudt/trustieforge into dev_raining

This commit is contained in:
Linda 2017-02-21 14:57:49 +08:00
commit 81ac923e3b
35 changed files with 604 additions and 270 deletions

View File

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

View File

@ -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项目IDTask 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,9 +15,12 @@
</div>
<!--加入、退出、关注项目-->
<div class="fr clear mr15">
<ul><span id="join_in_project_applied"><%= render :partial => "projects/applied_status" %></span></ul>
</div>
<% if true %>
<div class="fr clear mr15">
<ul><span id="join_in_project_applied"><%= render :partial => "projects/applied_status" %></span></ul>
</div>
<% end %>
<div class="cl"></div>
<% unless @project.forked_from_project_id.nil? %>
<div class="fl pro_new_name ml15 clear mt5">
@ -40,8 +43,8 @@
<% end %>
<!--实训任务-->
<% unless @project.enabled_modules.where("name = 'training_tasks'").empty? %>
<li id="project_menu_11">
<%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k training_tasks_count}</span>".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project, :remote => true), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
<li id="project_menu_011">
<%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k training_tasks_count}</span>".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
</li>
<% end %>
<!--讨论区-->
@ -87,7 +90,7 @@
</li>
<% 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? %>
<li id="project_menu_010">
<%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
</li>

View File

@ -1,11 +1,23 @@
<% if PraiseTread.praised(activity) %>
<a href='<%= praise_tread_praise_plus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
<a href='<%= praise_tread_praise_plus_path({:obj_id => activity.id,
:obj_type => activity.class,
:user_activity_id => user_activity_id,
:type => type }) %>'
data-remote="true"
class="<%= type == 'reply'? 'fr' : 'ml15' %> likeButton"
title="点赞" >
<span class="likeText">赞</span>
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
<span class="likeNum"><%= (num.nil? ? 0 : num) > 0 ? "#{(num.nil? ? 0 : num)}" : "" %></span>
</a>
<% else %>
<a href='<%= praise_tread_praise_minus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
<a href='<%= praise_tread_praise_minus_path({:obj_id => activity.id,
:obj_type => activity.class,
:user_activity_id => user_activity_id,
:type => type }) %>'
data-remote="true"
class="<%= type == 'reply'? 'fr' : 'ml15' %> likeButton"
title="取消点赞" >
<span class="likeText">已赞</span>
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
<span class="likeNum"><%= (num.nil? ? 0 : num) > 0 ? "#{(num.nil? ? 0 : num)}" : "" %></span>

View File

@ -36,7 +36,7 @@
<!--项目fork-->
<li class="mr5 fl">
<!--实训项目条件1、modules中选中了实训任务 2、不是fork的项目-->
<% 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 "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),

View File

@ -1,5 +1,5 @@
<h2 style="background: #fff; font-size: 14px; color: #333; height: 40px; line-height: 40px; padding-left: 15px; border-bottom:1px solid #e5e5e5;">项目简介
<% if User.current.member_of?(@project) %>
<% if User.current.member_of?(@project) && !@project.is_child_training_project? %>
<span class="fr mr15" id="project_invite_code">邀请码:<span style="color: #333;"><%= @project.invite_code %></span></span>
<% end %>
</h2>

View File

@ -0,0 +1 @@
$("#training_project_exec_tip").html('<%= escape_javascript( render :partial => 'projects/settings/training_project_exec_tip') %>');

View File

@ -55,7 +55,7 @@
</div><!--tbc_06 end-->
<div class="<%= show_memu == 'training_task' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_07">
<%= 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) %>
</div><!--tbc_06 end-->
</div>
</div>

View File

@ -1,26 +1,47 @@
<div class="alert alert-orange ml15 mr15 mb10"><p>提示文字</p></div>
<div id="training_project_exec_tip">
<%= render :partial => "projects/settings/training_project_exec_tip" %>
</div>
<div class=" sy_new_tchbox clear ">
<a href="#" class="fr sy_btn_green mb10">开启实训</a>
<div id="training_project_filter_tip">
<%= render :partial => "projects/settings/training_projects_filter_tip" %>
</div>
<div id="training_project_filter_tip">
</div>
<div class="cl"></div>
<div class="clear">
<textarea style="width:746px; height:300px;border: 1px solid #c8c8c8; padding:5px;margin-bottom: 5px;" placeholder="请输入脚本"></textarea>
<a href="javascript:void(0)" class="fr btn btn-grey">取消</a>
<a href="javascript:void(0)" class="fr btn btn-blue mr5">确定</a>
<%= form_tag(url_for(:controller => 'projects', :action => 'add_script', :project_id => @project.id), :id => 'project_script_form', :method => "post", :remote => true) do %>
<textarea id="project_script" name="project_script" style="width:746px; height:300px;border: 1px solid #c8c8c8; padding:5px;margin-bottom: 5px;" placeholder="请输入脚本"><%= @project.script %></textarea>
<span id ="project_script_tip" class="c_red" style="display: none">内容不能为空</span>
<a href="javascript:void(0)" class="fr btn btn-grey">取消</a>
<a href="javascript:void(0)" class="fr btn btn-blue mr5" onclick="project_script_commit()">确定</a>
<% end %>
</div>
</div>
<h3>请输入脚本</h3>
<p><%= link_to "开启实训", training_project_execute_project_path(@project) %></p>
<textarea id="pull_request_comment" name="pull_request_comment" class="pullreques_reply_textarea" style="padding-left: 0px;"></textarea>
<textarea>
node()
{
stage "first"
def args = "command=fileExists"
<script>
function regex_pr_comment()
{
var comment = $.trim($("#project_script").val());
if(comment.length == 0)
{
$("#project_script_tip").show();
return false;
}
else
{
$("#project_script_tip").hide();
return true;
}
}
def response = httpRequest acceptType: 'APPLICATION_JSON_UTF8', consoleLogResponseBody: true, contentType: 'APPLICATION_FORM', httpMode: 'POST', requestBody: args, url: "http://localhost:8080/jenkins-exec/pipeline/call?taskId=${taskId}"
println('Status: '+response.status)
println('Response: '+response.content)
}
</textarea>
//提交pull request_comment
function project_script_commit()
{
if(regex_pr_comment())
{
$("#project_script_form").submit();
}
}
</script>

View File

@ -0,0 +1,3 @@
<% if @notice %>
<div class="alert alert-orange ml15 mr15 mb10"><p><%= @notice %></p></div>
<% end %>

View File

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

View File

@ -1,6 +1,6 @@
<!--新版项目头部结束-->
<div class="ke-block pro_description_new_info mb10 " style="padding-bottom: 5px;word-break: normal;word-wrap: break-word" >
<div id="project_invite_code"><%= render :partial => 'projects/invite_code' %></div>
<div id="project_invite_code"><%= render :partial => 'projects/invite_code' %></div>
<div id="project_description_code" style="padding: 0 15px 10px 15px;font-size: 14px;">
<% if @project.description.blank? %>
<p style="padding-top:5px"><%= @project.name %></p>

View File

@ -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') %>');

View File

@ -7,7 +7,7 @@
<div class="sy_popup_con" style="width:380px;">
<ul class="sy_popup_add" >
<%# 实训项目和非实训项目,@type为true的时候为实训 %>
<% if @task %>
<% if @project.is_training_project? %>
<% if User.current.id == @project.user_id %>
<li class="center mb30" style="line-height:20px">
很抱歉,您不能在自己的实训项目中启动训练

View File

@ -1,12 +1,3 @@
<% tasks.each do |task| -%>
<%= render :partial => 'content_list', :locals => {:activity => task, :user_activity_id => task.id} %>
<% end %>
<div style="text-align:left;">
<div class="pages fr" style="width:auto; display:inline-block;">
<ul id="issue_list_pagination" class="fr">
<%= pagination_links_full @training_tasks_pages, @training_tasks_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% end %>

View File

@ -1,49 +1,38 @@
<% unless activity.author.nil? %>
<div class="issues_list_box clear" id="user_activity_<%= user_activity_id%>">
<div class="issues_ciricons fl ">
<span class="issues_ciricons_01"></span>
</div>
<div class=" fl ml5">
<div class="issues_list_titlebox clear">
<a href="<%= issue_path(activity) %>" class="issues_list_title fl" target="_blank" title="<%= activity.subject.to_s %>"><%= activity.subject.to_s %></a>
<div class="cl"></div>
<tr id="user_activity_<%= user_activity_id %>">
<td>
<% if activity.status == 0 %>
<div class="issues_ciricons fl ml15 mt5"><i class="icon-flag fb " style="color:#49a547; font-size:15px;"></i></div>
<% elsif activity.status == 1 %>
<div class="issues_ciricons fl ml15"><span class="issues_ciricons_02 "></span></div>
<% end %>
<div class=" fl ml5">
<div class="issues_list_titlebox clear">
<a href="<%= training_task_path(activity)%>" class="issues_list_title fl" target="_blank" title="<%= activity.subject.to_s %>" >
<span class="task-step mr5">step<%= activity.position %></span>
<%= activity.subject.to_s %>
</a>
<% if activity.status == 0 %>
<span class="task-linebtn-green fl ml5 mt3">正在解决中</span>
<% end %>
<div class="cl"></div>
</div>
<div class="issues_list_small">
<p class="fl issues_list_name" ><span class="mr5"><%= format_time(activity.created_at) %></span>发布</p>
<p class="fl ml10"> <span class="mr5"><%= format_time(activity.updated_at) %></span>更新</p>
</div>
</div>
<div class="issues_list_small">
<%# 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 %>
<!--p class="fl ml10"> <span class="mr5"><%#=format_time(activity.created_on) %></span>发布</p-->
<p class="fl" ><span class="mr5"><%= format_time(activity.created_at) %> </span>发布</p>
<p class="fl ml10"> <span class="mr5"><%= format_time(activity.updated_at) %> </span>更新</p>
</div>
</div>
<ul class="issues_list_txt fr">
<li class="c_grey">
<% 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 %>
</li>
<li class="issues_list_min c_grey mr5">
<% case activity.tracker_id %>
<% when 1%>
缺陷
<% when 2%>
功能
<% when 3%>
支持
<% when 4%>
任务
<% when 5%>
周报
<% end %>
</li>
</ul>
</div>
</td>
<td >
<% if activity.journals.count != 0 %>
<a href="javascript:void(0);" class="issues_icons_mes fl mr5 ml5 "></a>
<a href="javascript:void(0);" class="fl mt2"><%= activity.journals.count %></a>
<% end %>
</td>
<td>
<%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "btn btn-blue", :remote => true %>
</td>
</tr>
<% end %>
<script>

View File

@ -4,19 +4,7 @@
</div>
<div class="talk_txt fl">
<p class="pro_page_tit" style="word-break:break-all;">
<% case @training_task.tracker_id %>
<% when 1%>
<span class="fl" title="缺陷">【缺陷】</span>
<% when 2%>
<span class="fl" title="功能">【功能】</span>
<% when 3%>
<span class="fl" title="支持">【支持】</span>
<% when 4%>
<span class="fl" title="任务">【任务】</span>
<% when 5%>
<span class="fl" title="周报">【周报】</span>
<% end %>
</span> <span style="padding-left: 5px;"><%= @training_task.subject %></span></p>
<span style="padding-left: 5px;"><%= @training_task.subject %></span></p>
<!--<span class='<%#= "#{get_issue_priority(@training_task.priority_id)[0]} " %>'><%#= get_issue_priority(@training_task.priority_id)[1] %></span></p>-->
<br>
<div class="cl"></div>
@ -38,8 +26,8 @@
<% end -%>
<%# 附件局部刷新 %>
<div id = "div_issue_attachment_<%=@training_task.id %>">
<%= render :partial => 'task_attachments',:locals => {:training_task => @training_task} %>
<div id = "div_issue_attachment_<%= @training_task.id %>">
<%= render :partial => 'task_attachments', :locals => {:training_task => @training_task} %>
</div>
<!--属性-->
<%#= render :partial => 'issues/attributes_show' %>

View File

@ -6,11 +6,11 @@
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<li class="reply-container ml15" nhname="reply_rec">
<div class="homepagePostReplyPortrait" >
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=comment.id %>').hide();">
<div class="reply-content ml15" onmouseover="$('#delete_reply_<%= comment.id %>').show();" onmouseout="$('#delete_reply_<%= comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'Issue', :user_activity_id => issue.id}%>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
@ -28,44 +28,49 @@
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
</span>
<span style="position: relative" class="fr mr20">
<%= 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)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<%= 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 %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<p id="reply_message_<%= comment.id %>"></p>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="reply-container borderBottomNone minHeight48 ml15">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @training_task.id %>">
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@training_task.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyInputContainer mb10">
<div class="homepagePostReplyInputContainer mb10 reply-content">
<% if User.current.logged? %>
<div nhname='new_message_<%= @training_task.id %>' style="display:none;">
<%= 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| %>
<input type="hidden" name="issue_id" value="<%=@training_task.id%>"/>
<div nhname='toolbar_container_<%= @training_task.id %>' ></div>
<div class="cl"></div>

View File

@ -1,5 +1,6 @@
<% count = @training_task.journals.count %>
回复<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
回复<span class="mr15"><%= count > 0 ? "#{count}" : "" %></span>
<span style="color: #cecece;">▪</span>
<span id="praise_count_<%= @training_task.id %>">
<%=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"}%>
</span>

View File

@ -1,4 +1,4 @@
<% if training_task.attachments.any? %>
<% if training_task.attachments.any? %>
<div class="pro_pic_box mb10">
<a href="javascript:void(0)" class="link_img fl">
<!--显示附件、图片-->

View File

@ -0,0 +1,27 @@
<div class="ReplyToMessageContainer borderBottomNone " id="reply_to_message_<%= @jour.id %>" style="width:895px;">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @jour.id%>">
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@training_task.author_id), :alt => "用户头像" %>
</div>
<div class="ReplyToMessageInputContainer">
<% if User.current.logged? %>
<div nhname='new_message_<%= @jour.id %>' style="display:none;">
<%= form_for('new_form',:url => add_reply_training_tasks_path(@training_task.id, :is_issue_show => true),:method => "post", :remote => true) do |f|%>
<input type="hidden" name="journal_id" value="<%= @jour.id %>"/>
<div nhname='toolbar_container_<%= @jour.id %>' ></div>
<div class="cl"></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @jour.id%>' name="content"></textarea>
<div class="cl"></div>
<span nhname='contentmsg_<%= @jour.id %>' class="fl"></span>
<a id="new_message_submit_btn_<%= @jour.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<% end %>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
</div>

View File

@ -0,0 +1 @@

View File

@ -202,6 +202,57 @@
}
</script>
<!--实训任务列表开始-->
<div class="myissues_con mb10">
<% if !@project.is_child_training_project? || User.current.admin? %>
<a href="<%= new_project_training_task_path(@project) %>" class="btn btn-green fr mb10">新建</a>
<div class="cl"></div>
<% else %>
<div class="pro_new_prompt mb10">
<p>完成任务后,请点击“提交评测”按钮,若通过系统测试,将为你发送下一个任务,祝你早日通关,加油!</p>
</div>
<% end %>
<% if @training_tasks.empty? %>
<%= render :partial => "projects/no_data" %>
<% else %>
<div class="issues_con_list" >
<div >
<table class="issues-table" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th><p class="text-left">所有<span class="issues_nav_tag ml5" style=" font-weight: normal;"><%= @training_tasks_count %></span></p></th>
<th class="w50">&nbsp;</th>
<th class="w100">&nbsp;</th>
</tr>
</thead>
<tbody id="issue_list">
<%= render :partial => 'all_list', :locals => {:tasks => @training_tasks} %>
</tbody>
</table>
<div style="text-align:left;">
<div style="width:auto; display:inline-block;">
<ul>
<a href="javascript:void(0);" id="sendexcel" class="fl ml15 mt15" style="<%= @training_tasks_count > 10 ? 'height:24px;line-height:0;' : 'height:0;line-height:0;' %>"></a>
</ul>
</div>
<div class="pages fr" style="width:auto; display:inline-block;">
<ul id="issue_list_pagination" class="fr">
<%= pagination_links_full @training_tasks_pages, @training_tasks_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<% end %>
</div>
<!--实训任务结束-->
<% if false %>
<!--缺陷列表开始-->
<div id="myissues_con" class="myissues_con mb10">
<div class="clear mb5">
@ -230,3 +281,4 @@
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
<!--issues_con_list end-->
<% end %>

View File

@ -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 %>');

View File

@ -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("<p id='reply_message_<%= @jour.id %>'></p>");
}

View File

@ -3,16 +3,16 @@
<%= javascript_include_tag 'create_kindeditor'%>
<% end %>
<script>
sd_create_editor_from_data(<%= @training_task.id%>, null, "100%", "<%= @training_task.class.name %>");
sd_create_editor_from_data(<%= @training_task.id %>, null, "100%", "<%= @training_task.class.name %>");
</script>
<div class="mt10 mb10" id =issue_show_total"">
<div class="banner-big f16 fontGrey3">
任务详情
<a href="<%= new_project_training_task_path(@project)%>" class="sy_btn_green fr" >新建</a>
<a href="<%= new_project_training_task_path(@project) %>" class="sy_btn_green fr" >新建</a>
</div>
<div class="resources mt10" style="float:left;">
<div class="container-big mt10" style="float:left;">
<div class="pro_page_box">
<div class="problem_main borderBottomNone">
<div id="issue_detail_show">
@ -22,16 +22,16 @@
<!--problem_main end-->
<div style="clear: both;"></div>
<div class="homepagePostReply">
<div class="topBorder" style="display: <%= @training_task.journals.count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" >
<div class="homepagePostReplyBannerCount">
<%=render :partial => 'reply_banner' %>
<div class="container-big-grey">
<div class="topBorder" style="display: <%= @training_task.journals.count > 0 ? 'none': '' %>"></div>
<div class="reply-banner" >
<div class="homepagePostReplyBannerCount" id="training_task_reply_banner">
<%= render :partial => 'reply_banner' %>
</div>
<div class="homepagePostReplyBannerTime"></div>
</div>
<div class="" id="reply_div_<%= @training_task.id %>" >
<%= render :partial => 'issue_replies',:locals => {:issue => @training_task, :replies_all_i => 0} %>
<%= render :partial => 'issue_replies',:locals => {:issue => @training_task, :replies_all_i => 0 } %>
</div>
</div>
</div>

View File

@ -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 %>");

View File

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

View File

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