Commit 23ed285d by Bui Minh Duc

completed db modeling

parent 6e467428
......@@ -11,6 +11,10 @@ class MainController < ApplicationController
@selected_repos_obj.append(repo_obj)
end
@labels = @label || Label.all
@cols = ["discussion", "todo", "inprogress",
"vnreview", "jpreview", "ready",
"done", "releasefailed", "pending"]
end
def update_repo_selected
......
class Repository < ApplicationRecord
has_many :issues
has_many :labels
end
......@@ -7,9 +7,9 @@ namespace :github do
insert_users($client)
db_repos = Repository.all
# db_repos.each do |db_repo|
# insert_labels(db_repo, $client)
# end
db_repos.each do |db_repo|
insert_labels(db_repo, $client)
end
db_repos.each do |db_repo|
insert_issues(db_repo, $client)
......@@ -153,7 +153,11 @@ namespace :github do
db_issue.labels.append(db_label)
end
# TODO implement assignees relation
issue.assignees.each do |assignee|
db_assignee = User.where(id: assignee.id).first
db_issue.users.append(db_assignee)
end
if db_issue.save
if new_flag
puts "Insert issue success: " + issue.title
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment