add migrate
This commit is contained in:
parent
0beebb2d52
commit
eb457f4774
|
|
@ -91,20 +91,20 @@ class GamesController < ApplicationController
|
|||
# git_repository_url @myshixun, "Myshixun"
|
||||
# @st 0 实践任务 1 选择题任务
|
||||
def show
|
||||
g = Gitlab.client
|
||||
g_name = g.project(@myshixun.gpid).try(:name)
|
||||
g_rep = @myshixun.repository
|
||||
g_identifier = g_rep.try(:identifier)
|
||||
if g_name.include?("-") || g_identifier.include?("-")
|
||||
g_user_id = @myshixun.owner.try(:gid)
|
||||
g_name = g_name.split("-")
|
||||
g_project_name = g_name[0]
|
||||
num = g_name[1]
|
||||
g_id = g.current_user_project(g_user_id, g_project_name).first.try(:id)
|
||||
sql = "update `repositories` set identifier='#{g_project_name}' where id=#{g_rep.id}"
|
||||
ActiveRecord::Base.connection.execute(sql)
|
||||
@myshixun.update_attribute(:gpid, g_id)
|
||||
end
|
||||
# g = Gitlab.client
|
||||
# g_name = g.project(@myshixun.gpid).try(:name)
|
||||
# g_rep = @myshixun.repository
|
||||
# g_identifier = g_rep.try(:identifier)
|
||||
# if g_name.include?("-") || g_identifier.include?("-")
|
||||
# g_user_id = @myshixun.owner.try(:gid)
|
||||
# g_name = g_name.split("-")
|
||||
# g_project_name = g_name[0]
|
||||
# num = g_name[1]
|
||||
# g_id = g.current_user_project(g_user_id, g_project_name).first.try(:id)
|
||||
# sql = "update `repositories` set identifier='#{g_project_name}' where id=#{g_rep.id}"
|
||||
# ActiveRecord::Base.connection.execute(sql)
|
||||
# @myshixun.update_attribute(:gpid, g_id)
|
||||
# end
|
||||
# 展示全部实训
|
||||
# git_myshixun_url_ip @myshixun, user_id
|
||||
@is_subject = params[:is_subject]
|
||||
|
|
@ -112,6 +112,7 @@ class GamesController < ApplicationController
|
|||
# 放置页面ajax数据还没获取就关闭
|
||||
@game.update_attribute(:status, 0)
|
||||
end
|
||||
|
||||
# logger.info("#################%%%%%%#{@game.outputs.first.out_put}")
|
||||
# @games = @myshixun.games.includes(:challenge)
|
||||
@game_challenge = @game.challenge
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ class ShixunsController < ApplicationController
|
|||
s.sync_user(User.current)
|
||||
end
|
||||
gshixun = g.fork(@shixun.gpid, User.current.gid)
|
||||
if !gshixun.try(:id).blank?
|
||||
if gshixun.try(:id).present?
|
||||
myshixun.update_column(:gpid, gshixun.id) if myshixun.try(:gpid).blank?
|
||||
# educoder 加入到myshixun中
|
||||
myshixun_admin_gid = User.where(:login => "educoder").first.try(:gid)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
# 使用请了解以下描述,不清楚请@Hjqreturn
|
||||
#
|
||||
# user_id: 信息接收人
|
||||
# trigger_user_id: 信息的触发者,具体情况可能有所不同。eg:产生消息的用户ID;处理消息的用户ID等
|
||||
# container_id:消息实体的ID。eg:issue的id
|
||||
# container_type:消息实体的类型。eg:“Issue","Board"
|
||||
# parent_container_id:消息实体的父实体消息的id,是为了生成url时使用,避免反复查数据库。eg:message中的board 的id
|
||||
# parent_container_type:消息实体的父实体消息类型,便于分类。eg:“Message","Board"
|
||||
# belong_container_id:消息实体所属的实体ID。eg:project_id,course_id,organization_id
|
||||
# belong_container_type:消息实体所属的实体类型。eg:“Project”,“Course”,"Shixun"
|
||||
# status:消息实体的状态。eg:“已处理”,“未处理”
|
||||
# viewed:消息是否已读。eg:1 -> 已读; 0 -> 未读
|
||||
#
|
||||
class Tiding < ActiveRecord::Base
|
||||
attr_accessible :belong_container_id, :belong_container_type, :container_id, :container_type, :parent_container_id,
|
||||
:parent_container_type, :status, :trigger_user_id, :user_id, :viewed
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
class CreateTidings < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :tidings do |t|
|
||||
t.integer :user_id
|
||||
t.integer :trigger_user_id
|
||||
t.integer :container_id
|
||||
t.string :container_type
|
||||
t.integer :parent_container_id
|
||||
t.string :parent_container_type
|
||||
t.integer :belong_container_id
|
||||
t.string :belong_container_type
|
||||
t.integer :status
|
||||
t.boolean :viewed
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue