Commit 23ed285d by Bui Minh Duc

completed db modeling

parent 6e467428
...@@ -11,6 +11,10 @@ class MainController < ApplicationController ...@@ -11,6 +11,10 @@ class MainController < ApplicationController
@selected_repos_obj.append(repo_obj) @selected_repos_obj.append(repo_obj)
end end
@labels = @label || Label.all @labels = @label || Label.all
@cols = ["discussion", "todo", "inprogress",
"vnreview", "jpreview", "ready",
"done", "releasefailed", "pending"]
end end
def update_repo_selected def update_repo_selected
......
class Repository < ApplicationRecord class Repository < ApplicationRecord
has_many :issues
has_many :labels
end end
...@@ -7,9 +7,9 @@ namespace :github do ...@@ -7,9 +7,9 @@ namespace :github do
insert_users($client) insert_users($client)
db_repos = Repository.all db_repos = Repository.all
# db_repos.each do |db_repo| db_repos.each do |db_repo|
# insert_labels(db_repo, $client) insert_labels(db_repo, $client)
# end end
db_repos.each do |db_repo| db_repos.each do |db_repo|
insert_issues(db_repo, $client) insert_issues(db_repo, $client)
...@@ -153,7 +153,11 @@ namespace :github do ...@@ -153,7 +153,11 @@ namespace :github do
db_issue.labels.append(db_label) db_issue.labels.append(db_label)
end 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 db_issue.save
if new_flag if new_flag
puts "Insert issue success: " + issue.title 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