Commit 4e21255b by Bui Minh Duc

implemented setting 1

parent 3d7b1ef9
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
// Place all the styles related to the settings controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
...@@ -39,6 +39,55 @@ class IssuesController < ApplicationController ...@@ -39,6 +39,55 @@ class IssuesController < ApplicationController
@comments = @issue.comments @comments = @issue.comments
@rv_comments = @issue.review_comments @rv_comments = @issue.review_comments
@label_data = {
"discussion" => nil,
"todo" => nil,
"inprogress" => nil,
"vnreview" => nil,
"jpreview" => nil,
"ready" => nil,
"done" => nil,
"releasefailed" => nil,
"pending" => nil
}
timelines = @issue.timelines
timelines.each do |timeline|
if @label_data[timeline.label].nil?
@label_data[timeline.label] = { "time" => 0, "data" => [] }
end
time = 0
if timeline.end_time.nil? # task is not finished
time = Time.now - timeline.started_time
else
time = timeline.end_time - timeline.started_time
end
@label_data[timeline.label]["time"] += time
@label_data[timeline.label]["data"].append(timeline)
end
@started_time = nil
start = timelines.where(label: "inprogress").first
unless start.nil?
@started_time = start.started_time
end
@end_time = nil
end_t = timelines.where(label: "done").first
unless end_t.nil?
@end_time = end_t.started_time
end
@duration = nil
if @started_time.nil?
@duration = "---"
elsif @end_time.nil?
@duration = Time.now - @started_time
else
@duration = @end_time - @started_time
end
@options = [ @options = [
{id: 0, type: "None"}, {id: 0, type: "None"},
{id: 1, type: "Small"}, {id: 1, type: "Small"},
......
class SettingsController < ApplicationController
def index
@repos = Repository.all
end
def update_setting_1
$repos_to_update = params[:selected]
end
end
module SettingsHelper
end
...@@ -21,6 +21,7 @@ class RepositoryJob < ApplicationJob ...@@ -21,6 +21,7 @@ class RepositoryJob < ApplicationJob
list_db_issue.each do |db_issue| list_db_issue.each do |db_issue|
db_issue.save db_issue.save
# byebug
end end
list_db_comment.each do |db_comment| list_db_comment.each do |db_comment|
......
...@@ -7,5 +7,7 @@ class Issue < ApplicationRecord ...@@ -7,5 +7,7 @@ class Issue < ApplicationRecord
has_many :review_comments has_many :review_comments
has_many :pull_requests, class_name: "Issue", foreign_key: "issue_id" has_many :pull_requests, class_name: "Issue", foreign_key: "issue_id"
belongs_to :issue, class_name: "Issue" belongs_to :issue, class_name: "Issue", optional: true
has_many :timelines
end end
...@@ -66,24 +66,24 @@ ...@@ -66,24 +66,24 @@
</ul> </ul>
</div> </div>
<table class="table table-bordered"> <table class="table table-bordered">
<!-- <thead>
<tr>
<th class="col-md-6">Started Time</th>
<th class="col-md-6">End Time</th>
</tr>
</thead> -->
<tbody> <tbody>
<tr> <tr>
<td class="col-md-4">Started Time</td> <td class="col-md-4">Started Time</td>
<td class="col-md-8">20/12/2016</td> <td class="col-md-8">
<%= @started_time %>
</td>
</tr> </tr>
<tr> <tr>
<td class="col-md-4">End Time</td> <td class="col-md-4">End Time</td>
<td class="col-md-8">---</td> <td class="col-md-8">
<%= @end_time %>
</td>
</tr> </tr>
<tr> <tr>
<td class="col-md-4">Duration</td> <td class="col-md-4">Duration</td>
<td class="col-md-8">10 days (66.67%)</td> <td class="col-md-8">
<%= @duration %>
</td>
</tr> </tr>
<tr> <tr>
<td class="col-md-4">Estimate</td> <td class="col-md-4">Estimate</td>
...@@ -95,38 +95,30 @@ ...@@ -95,38 +95,30 @@
<thead> <thead>
<tr> <tr>
<th class="col-md-4">Label</th> <th class="col-md-4">Label</th>
<th class="col-md-8">Duration</th> <th class="col-md-4">Duration</th>
<th class="col-md-4">Time</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <% @label_data.each do |key, value| %>
<td>discussion</td> <tr>
<td>10 hours</td> <td><%= key %></td>
</tr> <% if value.nil? %>
<tr> <td>---</td>
<td>todo</td> <td>---</td>
<td>10 hours</td> <% else %>
</tr> <td><%= value["time"].to_i %></td>
<tr> <td>
<td>inprogress</td> <select>
<td>3 hours</td> <% value["data"].each do |x| %>
</tr> <option><%= x.started_time.to_s + " - " + x.end_time.to_s %></option>
<tr> <% end %>
<td>vnreview</td> </select>
<td>3 hours</td> </td>
</tr> <% end %>
<tr>
<td>jpreview</td> </tr>
<td>3 hours</td> <% end %>
</tr>
<tr>
<td>ready</td>
<td>3 hours</td>
</tr>
<tr>
<td>done</td>
<td>3 hours</td>
</tr>
</tbody> </tbody>
</table> </table>
<div> <div>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li><%= link_to "User", user_path %></li> <li><%= link_to "User", user_path %></li>
<li><%= link_to "Repository", repositories_path %></li> <li><%= link_to "Repository", repositories_path %></li>
<li><%= link_to "Settings", settings_path %></li>
</ul> </ul>
</div> </div>
</div> </div>
......
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Settings 1</h4>
</div>
<div class="panel-body">
<p>Please choose some repositories. Picked repositories will be updated every 1 hour.</p>
<select class="selectpicker" id="selectpicker" multiple data-live-search="true" data-selected-text-format="count > 3" data-actions-box="true" style="display: none;">
<% @repos.each do |repo| %>
<option><%= repo.name %></option>
<% end %>
</select>
<button class="btn btn-default" id="btn1">Save</button>
<br><br>
<% if $repos_to_update.class == Array %>
<% $repos_to_update.each do |repo| %>
<span class="label label-primary"><%= repo %></span>
<% end %>
<% end %>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#selectpicker').selectpicker(); // init picker
<% if $repos_to_update.class == Array %>
$('#selectpicker').selectpicker('val', <%= $repos_to_update.to_s.html_safe %>);
<% end %>
});
$("#btn1").click(function() {
var selectedRepos = $('#selectpicker').selectpicker('val');
$.ajax({
method: "POST",
url: "<%= settings_1_path %>",
data: { selected: selectedRepos },
success: function(res) {
location.reload();
}
});
});
</script>
$client = Octokit::Client.new(access_token: Rails.application.secrets.GITHUB_TOKEN) $client = Octokit::Client.new(access_token: Rails.application.secrets.GITHUB_TOKEN)
$repos_to_update = []
...@@ -10,4 +10,7 @@ Rails.application.routes.draw do ...@@ -10,4 +10,7 @@ Rails.application.routes.draw do
resources :pulls resources :pulls
resources :repositories resources :repositories
resources :comments resources :comments
get "/settings", to: "settings#index"
post "/settings/1", to: "settings#update_setting_1"
end end
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
# Learn more: http://github.com/javan/whenever # Learn more: http://github.com/javan/whenever
set :environment, "development" set :environment, "development"
every 2.hour do # every 2.hour do
rake "github:insert_github_data" # rake "github:insert_github_data"
# end
every 1.hour do
rake "github:insert_github_data_for_specific_repos"
end end
No preview for this file type

14.4 KB | W: | H:

15.9 KB | W: | H:

design.png
design.png
design.png
design.png
  • 2-up
  • Swipe
  • Onion skin
# Logfile created on 2016-12-02 13:00:03 +0700 by logger.rb/54362 # Logfile created on 2016-12-02 13:00:03 +0700 by logger.rb/54362
I, [2016-12-28T16:33:02.316042 #12126] INFO -- : Begin task insert database from github
I, [2016-12-28T16:33:02.430848 #12126] INFO -- : Insert issues
I, [2016-12-28T16:33:14.875111 #12126] INFO -- : Insert comments
I, [2016-12-28T16:33:19.504494 #12126] INFO -- : Size list_db_comment: 80
I, [2016-12-28T16:33:19.504551 #12126] INFO -- : Insert review comments
I, [2016-12-28T16:33:21.796289 #12126] INFO -- : begin transaction
I, [2016-12-28T16:33:22.051691 #12126] INFO -- : Finished transaction in 0.255322035s
I, [2016-12-28T16:33:22.051784 #12126] INFO -- : Finished task import in 19.735731442s
I, [2016-12-30T14:32:40.517455 #18527] INFO -- : Begin task update smocca_v3
I, [2016-12-30T14:32:40.528488 #18527] INFO -- : Insert issues
I, [2016-12-30T14:32:54.999742 #18527] INFO -- : Insert comments
I, [2016-12-30T14:32:58.629240 #18527] INFO -- : Size list_db_comment: 60
I, [2016-12-30T14:32:58.629300 #18527] INFO -- : Insert review comments
I, [2016-12-30T14:33:01.264318 #18527] INFO -- : begin transaction
I, [2016-12-30T14:33:01.731749 #18527] INFO -- : Finished transaction in 0.467318922s
I, [2016-12-30T14:33:01.731815 #18527] INFO -- : Finished task update in 21.214364963s
I, [2016-12-30T14:46:27.453833 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T14:46:27.702208 #2776] INFO -- : Insert issues
I, [2016-12-30T14:46:45.200596 #2776] INFO -- : Insert comments
I, [2016-12-30T14:46:49.898564 #2776] INFO -- : Size list_db_comment: 80
I, [2016-12-30T14:46:49.898632 #2776] INFO -- : Insert review comments
I, [2016-12-30T14:46:52.254902 #2776] INFO -- : begin transaction
I, [2016-12-30T14:46:52.651578 #2776] INFO -- : Finished transaction in 0.396583406s
I, [2016-12-30T14:46:52.651645 #2776] INFO -- : Finished task update in 25.197811401s
I, [2016-12-30T14:49:22.901616 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T14:49:22.902025 #2776] INFO -- : Insert issues
I, [2016-12-30T14:49:38.710634 #2776] INFO -- : Insert comments
I, [2016-12-30T14:49:43.366026 #2776] INFO -- : Size list_db_comment: 80
I, [2016-12-30T14:49:43.366085 #2776] INFO -- : Insert review comments
I, [2016-12-30T14:49:45.711662 #2776] INFO -- : begin transaction
I, [2016-12-30T14:49:46.043514 #2776] INFO -- : Finished transaction in 0.331780826s
I, [2016-12-30T14:49:46.043575 #2776] INFO -- : Finished task update in 23.141957474s
I, [2016-12-30T14:50:30.643700 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T14:50:30.645501 #2776] INFO -- : Insert issues
I, [2016-12-30T14:50:45.873744 #2776] INFO -- : Insert comments
I, [2016-12-30T14:50:50.414228 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T14:50:50.414277 #2776] INFO -- : Insert review comments
I, [2016-12-30T14:50:52.669258 #2776] INFO -- : begin transaction
I, [2016-12-30T14:50:53.140189 #2776] INFO -- : Finished transaction in 0.470867619s
I, [2016-12-30T14:50:53.140241 #2776] INFO -- : Finished task update in 22.496541296s
I, [2016-12-30T14:52:03.415244 #2776] INFO -- : Begin task update kuruma-ex
I, [2016-12-30T14:52:03.415659 #2776] INFO -- : Insert issues
I, [2016-12-30T14:52:45.148954 #2776] INFO -- : Insert comments
I, [2016-12-30T14:52:47.458706 #2776] INFO -- : Size list_db_comment: 30
I, [2016-12-30T14:52:47.458760 #2776] INFO -- : Insert review comments
I, [2016-12-30T14:52:55.180638 #2776] INFO -- : begin transaction
I, [2016-12-30T14:52:55.882006 #2776] INFO -- : Finished transaction in 0.701302791s
I, [2016-12-30T14:52:55.882063 #2776] INFO -- : Finished task update in 52.466816725s
I, [2016-12-30T14:56:01.166672 #2776] INFO -- : Begin task update travel
I, [2016-12-30T14:56:01.172510 #2776] INFO -- : Insert issues
I, [2016-12-30T14:56:15.064782 #2776] INFO -- : Insert comments
I, [2016-12-30T14:56:18.517346 #2776] INFO -- : Size list_db_comment: 45
I, [2016-12-30T14:56:18.517403 #2776] INFO -- : Insert review comments
I, [2016-12-30T14:56:23.226049 #2776] INFO -- : begin transaction
I, [2016-12-30T14:56:23.801356 #2776] INFO -- : Finished transaction in 0.575220761s
I, [2016-12-30T14:56:23.801481 #2776] INFO -- : Finished task update in 22.634798443s
I, [2016-12-30T15:12:42.595698 #2776] INFO -- : Begin task update smocca_v3
I, [2016-12-30T15:12:42.607218 #2776] INFO -- : Insert issues
I, [2016-12-30T15:12:57.039218 #2776] INFO -- : Insert comments
I, [2016-12-30T15:13:00.619455 #2776] INFO -- : Size list_db_comment: 60
I, [2016-12-30T15:13:00.619513 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:13:01.856129 #2776] INFO -- : begin transaction
I, [2016-12-30T15:13:02.320146 #2776] INFO -- : Finished transaction in 0.46392881s
I, [2016-12-30T15:13:02.320203 #2776] INFO -- : Finished task update in 19.724506619s
I, [2016-12-30T15:32:44.596169 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T15:32:44.601644 #2776] INFO -- : Insert issues
I, [2016-12-30T15:32:57.694130 #2776] INFO -- : Insert comments
I, [2016-12-30T15:33:02.205663 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T15:33:02.205712 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:33:04.432706 #2776] INFO -- : begin transaction
I, [2016-12-30T15:33:04.721726 #2776] INFO -- : Finished transaction in 0.288955529s
I, [2016-12-30T15:33:04.721779 #2776] INFO -- : Finished task update in 20.125607949s
I, [2016-12-30T15:33:48.595895 #2776] INFO -- : Begin task update smocca_v3
I, [2016-12-30T15:33:48.601325 #2776] INFO -- : Insert issues
I, [2016-12-30T15:34:02.830621 #2776] INFO -- : Insert comments
I, [2016-12-30T15:34:06.384853 #2776] INFO -- : Size list_db_comment: 60
I, [2016-12-30T15:34:06.384902 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:34:08.685210 #2776] INFO -- : begin transaction
I, [2016-12-30T15:34:09.063648 #2776] INFO -- : Finished transaction in 0.378352762s
I, [2016-12-30T15:34:09.063704 #2776] INFO -- : Finished task update in 20.467811122s
I, [2016-12-30T15:34:24.867438 #2776] INFO -- : Begin task update ryokou_ios
I, [2016-12-30T15:34:24.867800 #2776] INFO -- : Insert issues
I, [2016-12-30T15:34:27.337627 #2776] INFO -- : Insert comments
I, [2016-12-30T15:34:29.516637 #2776] INFO -- : Size list_db_comment: 0
I, [2016-12-30T15:34:29.516700 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:34:31.725102 #2776] INFO -- : begin transaction
I, [2016-12-30T15:34:31.731756 #2776] INFO -- : Finished transaction in 0.006576029s
I, [2016-12-30T15:34:31.731835 #2776] INFO -- : Finished task update in 6.864391994s
I, [2016-12-30T15:34:50.418960 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T15:34:50.419611 #2776] INFO -- : Insert issues
I, [2016-12-30T15:35:03.285476 #2776] INFO -- : Insert comments
I, [2016-12-30T15:35:07.962564 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T15:35:07.962616 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:35:10.255062 #2776] INFO -- : begin transaction
I, [2016-12-30T15:35:10.614685 #2776] INFO -- : Finished transaction in 0.359559143s
I, [2016-12-30T15:35:10.614733 #2776] INFO -- : Finished task update in 20.195781172s
I, [2016-12-30T15:39:09.384923 #2776] INFO -- : Begin task update job.zigexn
I, [2016-12-30T15:39:09.390245 #2776] INFO -- : Insert issues
I, [2016-12-30T15:39:10.607594 #2776] INFO -- : Insert comments
I, [2016-12-30T15:39:12.799204 #2776] INFO -- : Size list_db_comment: 4
I, [2016-12-30T15:39:12.799252 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:39:17.909519 #2776] INFO -- : begin transaction
I, [2016-12-30T15:39:17.957636 #2776] INFO -- : Finished transaction in 0.048059228s
I, [2016-12-30T15:39:17.957692 #2776] INFO -- : Finished task update in 8.572767546s
I, [2016-12-30T15:39:24.137144 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T15:39:24.137459 #2776] INFO -- : Insert issues
I, [2016-12-30T15:39:38.985519 #2776] INFO -- : Insert comments
I, [2016-12-30T15:39:43.659304 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T15:39:43.659358 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:39:45.865400 #2776] INFO -- : begin transaction
I, [2016-12-30T15:39:46.132272 #2776] INFO -- : Finished transaction in 0.266782909s
I, [2016-12-30T15:39:46.132344 #2776] INFO -- : Finished task update in 21.995198485s
I, [2016-12-30T15:40:24.961427 #2776] INFO -- : Begin task update smocca_v3
I, [2016-12-30T15:40:24.961823 #2776] INFO -- : Insert issues
I, [2016-12-30T15:40:39.143984 #2776] INFO -- : Insert comments
I, [2016-12-30T15:40:42.705719 #2776] INFO -- : Size list_db_comment: 60
I, [2016-12-30T15:40:42.705771 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:40:46.151405 #2776] INFO -- : begin transaction
I, [2016-12-30T15:40:46.554076 #2776] INFO -- : Finished transaction in 0.402562983s
I, [2016-12-30T15:40:46.554132 #2776] INFO -- : Finished task update in 21.592705246s
I, [2016-12-30T15:41:42.005249 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T15:41:42.010851 #2776] INFO -- : Insert issues
I, [2016-12-30T15:41:56.844093 #2776] INFO -- : Insert comments
I, [2016-12-30T15:42:01.576666 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T15:42:01.576715 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:42:03.865435 #2776] INFO -- : begin transaction
I, [2016-12-30T15:42:04.149647 #2776] INFO -- : Finished transaction in 0.284119089s
I, [2016-12-30T15:42:04.149699 #2776] INFO -- : Finished task update in 22.144449764s
I, [2016-12-30T15:42:06.504257 #2776] INFO -- : Begin task update smocca_v3
I, [2016-12-30T15:42:06.504519 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:07.180511 #2776] INFO -- : Begin task update travel
I, [2016-12-30T15:42:07.180719 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:07.976147 #2776] INFO -- : Begin task update chef-repo
I, [2016-12-30T15:42:07.976383 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:08.510625 #2776] INFO -- : Begin task update tenshoku_r4
I, [2016-12-30T15:42:08.510995 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:09.019438 #2776] INFO -- : Begin task update zinfo
I, [2016-12-30T15:42:09.019634 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:16.026384 #2776] INFO -- : Begin task update job.zigexn
I, [2016-12-30T15:42:16.027652 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:26.959110 #2776] INFO -- : Insert comments
I, [2016-12-30T15:42:33.722040 #2776] INFO -- : Begin task update global_job_crawler
I, [2016-12-30T15:42:33.723810 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:33.821250 #2776] INFO -- : Begin task update zucchini_server
I, [2016-12-30T15:42:33.821645 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:34.155562 #2776] INFO -- : Begin task update zucchini_client
I, [2016-12-30T15:42:34.155878 #2776] INFO -- : Insert issues
I, [2016-12-30T15:42:34.595427 #2776] INFO -- : Size list_db_comment: 4
I, [2016-12-30T15:42:34.595474 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:42:48.111222 #2776] INFO -- : Insert comments
I, [2016-12-30T15:42:50.460319 #2776] INFO -- : Size list_db_comment: 17
I, [2016-12-30T15:42:50.460371 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:42:50.992037 #2776] INFO -- : begin transaction
I, [2016-12-30T15:42:51.074534 #2776] INFO -- : Finished transaction in 0.082430353s
I, [2016-12-30T15:42:51.074611 #2776] INFO -- : Finished task update in 35.048222301s
I, [2016-12-30T15:42:53.071129 #2776] INFO -- : begin transaction
I, [2016-12-30T15:42:58.423868 #2776] INFO -- : Finished transaction in 5.352664228s
I, [2016-12-30T15:42:58.424000 #2776] INFO -- : Finished task update in 24.268433907s
I, [2016-12-30T15:43:12.816892 #2776] INFO -- : Begin task update zinfo
I, [2016-12-30T15:43:12.817218 #2776] INFO -- : Insert issues
I, [2016-12-30T15:43:15.037496 #2776] INFO -- : Insert comments
I, [2016-12-30T15:43:17.293651 #2776] INFO -- : Size list_db_comment: 1
I, [2016-12-30T15:43:17.293689 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:43:19.436353 #2776] INFO -- : begin transaction
I, [2016-12-30T15:43:19.442064 #2776] INFO -- : Finished transaction in 0.005618008s
I, [2016-12-30T15:43:19.442124 #2776] INFO -- : Finished task update in 6.625230019s
I, [2016-12-30T15:44:02.584010 #2776] INFO -- : Begin task update zinfo
I, [2016-12-30T15:44:02.590329 #2776] INFO -- : Insert issues
I, [2016-12-30T15:44:04.746308 #2776] INFO -- : Insert comments
I, [2016-12-30T15:44:06.977007 #2776] INFO -- : Size list_db_comment: 1
I, [2016-12-30T15:44:06.977069 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:44:09.166472 #2776] INFO -- : begin transaction
I, [2016-12-30T15:44:09.179973 #2776] INFO -- : Finished transaction in 0.013397413s
I, [2016-12-30T15:44:09.180017 #2776] INFO -- : Finished task update in 6.59602454s
I, [2016-12-30T15:44:56.944974 #2776] INFO -- : Begin task update zinfo
I, [2016-12-30T15:44:56.950156 #2776] INFO -- : Insert issues
I, [2016-12-30T15:44:59.211773 #2776] INFO -- : Insert comments
I, [2016-12-30T15:45:01.429736 #2776] INFO -- : Size list_db_comment: 1
I, [2016-12-30T15:45:01.429797 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:45:03.760928 #2776] INFO -- : begin transaction
I, [2016-12-30T15:45:03.772947 #2776] INFO -- : Finished transaction in 0.011909284s
I, [2016-12-30T15:45:03.773042 #2776] INFO -- : Finished task update in 6.828063311s
I, [2016-12-30T15:47:33.613324 #2776] INFO -- : Begin task update tenshoku_r4
I, [2016-12-30T15:47:33.623729 #2776] INFO -- : Insert issues
I, [2016-12-30T15:48:08.099328 #2776] INFO -- : Insert comments
I, [2016-12-30T15:48:13.061748 #2776] INFO -- : Size list_db_comment: 90
I, [2016-12-30T15:48:13.061797 #2776] INFO -- : Insert review comments
I, [2016-12-30T15:48:27.127150 #2776] INFO -- : begin transaction
I, [2016-12-30T15:48:27.603449 #2776] INFO -- : Finished transaction in 0.476240505s
I, [2016-12-30T15:48:27.603510 #2776] INFO -- : Finished task update in 53.99019086s
I, [2016-12-30T16:07:26.745461 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T16:07:26.745918 #2776] INFO -- : Insert issues
I, [2016-12-30T16:07:41.118137 #2776] INFO -- : Insert comments
I, [2016-12-30T16:07:45.694271 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T16:07:45.694317 #2776] INFO -- : Insert review comments
I, [2016-12-30T16:07:47.916588 #2776] INFO -- : begin transaction
I, [2016-12-30T16:07:48.562116 #2776] INFO -- : Finished transaction in 0.645457092s
I, [2016-12-30T16:07:48.562271 #2776] INFO -- : Finished task update in 21.816804591s
I, [2016-12-30T16:08:10.422049 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T16:08:10.422469 #2776] INFO -- : Insert issues
I, [2016-12-30T16:08:24.223769 #2776] INFO -- : Insert comments
I, [2016-12-30T16:08:28.940412 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T16:08:28.940459 #2776] INFO -- : Insert review comments
I, [2016-12-30T16:08:31.155660 #2776] INFO -- : begin transaction
I, [2016-12-30T16:08:31.434482 #2776] INFO -- : Finished transaction in 0.278760968s
I, [2016-12-30T16:08:31.434536 #2776] INFO -- : Finished task update in 21.012490776s
I, [2016-12-30T16:09:06.599105 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T16:09:06.599437 #2776] INFO -- : Insert issues
I, [2016-12-30T16:09:09.043008 #2776] INFO -- : nil
I, [2016-12-30T16:09:09.454661 #2776] INFO -- : nil
I, [2016-12-30T16:09:09.591588 #2776] INFO -- : nil
I, [2016-12-30T16:09:10.037274 #2776] INFO -- : nil
I, [2016-12-30T16:09:10.460587 #2776] INFO -- : nil
I, [2016-12-30T16:09:10.620550 #2776] INFO -- : nil
I, [2016-12-30T16:09:11.304745 #2776] INFO -- : nil
I, [2016-12-30T16:09:11.640294 #2776] INFO -- : nil
I, [2016-12-30T16:09:11.938301 #2776] INFO -- : nil
I, [2016-12-30T16:09:12.080401 #2776] INFO -- : nil
I, [2016-12-30T16:09:12.215896 #2776] INFO -- : nil
I, [2016-12-30T16:09:12.224902 #2776] INFO -- : nil
I, [2016-12-30T16:09:12.450290 #2776] INFO -- : nil
I, [2016-12-30T16:09:12.605103 #2776] INFO -- : nil
I, [2016-12-30T16:09:12.792025 #2776] INFO -- : nil
I, [2016-12-30T16:09:12.951680 #2776] INFO -- : nil
I, [2016-12-30T16:09:13.191918 #2776] INFO -- : nil
I, [2016-12-30T16:09:13.360256 #2776] INFO -- : nil
I, [2016-12-30T16:09:13.364887 #2776] INFO -- : nil
I, [2016-12-30T16:09:13.893345 #2776] INFO -- : nil
I, [2016-12-30T16:09:13.898078 #2776] INFO -- : nil
I, [2016-12-30T16:09:13.903049 #2776] INFO -- : nil
I, [2016-12-30T16:09:14.076755 #2776] INFO -- : nil
I, [2016-12-30T16:09:14.234881 #2776] INFO -- : nil
I, [2016-12-30T16:09:14.785774 #2776] INFO -- : nil
I, [2016-12-30T16:09:15.115030 #2776] INFO -- : nil
I, [2016-12-30T16:09:15.465078 #2776] INFO -- : nil
I, [2016-12-30T16:09:15.751930 #2776] INFO -- : nil
I, [2016-12-30T16:09:15.995385 #2776] INFO -- : nil
I, [2016-12-30T16:09:16.152271 #2776] INFO -- : nil
I, [2016-12-30T16:09:17.441971 #2776] INFO -- : nil
I, [2016-12-30T16:09:17.962037 #2776] INFO -- : nil
I, [2016-12-30T16:09:18.197500 #2776] INFO -- : nil
I, [2016-12-30T16:09:18.912260 #2776] INFO -- : nil
I, [2016-12-30T16:09:18.917832 #2776] INFO -- : nil
I, [2016-12-30T16:09:18.925140 #2776] INFO -- : nil
I, [2016-12-30T16:09:18.929918 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.556776 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.568412 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.573367 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.578469 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.586037 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.590611 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.596644 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.602639 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.607656 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.613937 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.620241 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.626029 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.632367 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.755197 #2776] INFO -- : nil
I, [2016-12-30T16:09:19.920672 #2776] INFO -- : Insert comments
I, [2016-12-30T16:09:24.544010 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T16:09:24.544065 #2776] INFO -- : Insert review comments
I, [2016-12-30T16:09:26.726351 #2776] INFO -- : begin transaction
I, [2016-12-30T16:09:26.998100 #2776] INFO -- : Finished transaction in 0.27166864s
I, [2016-12-30T16:09:26.998165 #2776] INFO -- : Finished task update in 20.399063768s
I, [2016-12-30T16:23:31.658827 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T16:23:31.663975 #2776] INFO -- : Insert issues
I, [2016-12-30T16:23:45.988169 #2776] INFO -- : Insert comments
I, [2016-12-30T16:23:50.727536 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T16:23:50.727613 #2776] INFO -- : Insert review comments
I, [2016-12-30T16:23:52.990194 #2776] INFO -- : begin transaction
I, [2016-12-30T16:23:53.256624 #2776] INFO -- : Finished transaction in 0.26633209s
I, [2016-12-30T16:23:53.256680 #2776] INFO -- : Finished task update in 21.597848765s
I, [2016-12-30T16:25:02.156557 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T16:25:02.156965 #2776] INFO -- : Insert issues
I, [2016-12-30T16:25:04.587226 #2776] INFO -- : nil
I, [2016-12-30T16:25:05.000249 #2776] INFO -- : #<Label id: 476826290, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "inprogress", color: "ededed", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:05.168536 #2776] INFO -- : nil
I, [2016-12-30T16:25:05.707695 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:06.205357 #2776] INFO -- : nil
I, [2016-12-30T16:25:06.367373 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:07.132948 #2776] INFO -- : nil
I, [2016-12-30T16:25:07.539733 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:07.851037 #2776] INFO -- : nil
I, [2016-12-30T16:25:08.017074 #2776] INFO -- : #<Label id: 476826290, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "inprogress", color: "ededed", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:08.185116 #2776] INFO -- : nil
I, [2016-12-30T16:25:08.191329 #2776] INFO -- : nil
I, [2016-12-30T16:25:08.466035 #2776] INFO -- : nil
I, [2016-12-30T16:25:08.632375 #2776] INFO -- : nil
I, [2016-12-30T16:25:08.821884 #2776] INFO -- : nil
I, [2016-12-30T16:25:08.981588 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:09.236349 #2776] INFO -- : nil
I, [2016-12-30T16:25:09.422706 #2776] INFO -- : nil
I, [2016-12-30T16:25:09.427702 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:09.947158 #2776] INFO -- : nil
I, [2016-12-30T16:25:09.953751 #2776] INFO -- : nil
I, [2016-12-30T16:25:09.960340 #2776] INFO -- : nil
I, [2016-12-30T16:25:10.114188 #2776] INFO -- : nil
I, [2016-12-30T16:25:10.263783 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:10.839453 #2776] INFO -- : #<Label id: 476826290, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "inprogress", color: "ededed", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:11.192985 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:11.701251 #2776] INFO -- : nil
I, [2016-12-30T16:25:12.021903 #2776] INFO -- : #<Label id: 475097787, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "ready", color: "0e8a16", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:12.289393 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:12.465062 #2776] INFO -- : #<Label id: 475098000, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "done", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:13.824491 #2776] INFO -- : #<Label id: 475096942, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "vnreview", color: "006b75", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:14.573808 #2776] INFO -- : #<Label id: 476800397, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "todo", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:14.842663 #2776] INFO -- : #<Label id: 476800397, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "todo", color: "1d76db", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:15.615749 #2776] INFO -- : nil
I, [2016-12-30T16:25:15.620736 #2776] INFO -- : nil
I, [2016-12-30T16:25:15.628482 #2776] INFO -- : nil
I, [2016-12-30T16:25:15.633337 #2776] INFO -- : #<Label id: 475097787, url: "https://api.github.com/repos/ZIGExN/socialtools/la...", name: "ready", color: "0e8a16", default: false, repository_id: 14416595, created_at: "2016-12-23 04:26:16", updated_at: "2016-12-23 04:26:16">
I, [2016-12-30T16:25:16.173722 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.181399 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.186540 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.191729 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.197811 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.203006 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.207692 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.215236 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.223255 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.231367 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.237301 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.247190 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.253239 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.417183 #2776] INFO -- : nil
I, [2016-12-30T16:25:16.574149 #2776] INFO -- : Insert comments
I, [2016-12-30T16:25:21.142155 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T16:25:21.142200 #2776] INFO -- : Insert review comments
I, [2016-12-30T16:25:23.335786 #2776] INFO -- : begin transaction
I, [2016-12-30T16:25:23.601487 #2776] INFO -- : Finished transaction in 0.265632957s
I, [2016-12-30T16:25:23.601560 #2776] INFO -- : Finished task update in 21.44500081s
I, [2016-12-30T16:26:20.972301 #2776] INFO -- : Begin task update socialtools
I, [2016-12-30T16:26:20.972556 #2776] INFO -- : Insert issues
I, [2016-12-30T16:26:34.286874 #2776] INFO -- : Insert comments
I, [2016-12-30T16:26:38.903525 #2776] INFO -- : Size list_db_comment: 81
I, [2016-12-30T16:26:38.903570 #2776] INFO -- : Insert review comments
I, [2016-12-30T16:26:41.144409 #2776] INFO -- : begin transaction
I, [2016-12-30T16:26:41.447372 #2776] INFO -- : Finished transaction in 0.302898043s
I, [2016-12-30T16:26:41.447443 #2776] INFO -- : Finished task update in 20.47513899s
...@@ -146,17 +146,19 @@ class GithubLoader ...@@ -146,17 +146,19 @@ class GithubLoader
new_label = db_issue.labels.find_by(name: col_labels) new_label = db_issue.labels.find_by(name: col_labels)
if old_label.nil? if old_label.nil?
unless new_label.nil? unless new_label.nil?
timeline = Timeline.new new_timeline(db_issue.id, new_label.name)
timeline.issue_id = db_issue.id
timeline.label = new_label.name
timeline.started_time = Time.now
timeline.save
$logger.info "Hello"
end end
elsif new_label.name != old_label.name elsif new_label.name != old_label.name
timeline = Timeline.where(issue_id: db_issue.id, label: old_label.name).first timeline = Timeline.where(issue_id: db_issue.id, label: old_label.name).first
timeline.end_time = Time.now timeline.end_time = Time.now
timeline.save timeline.save
new_timeline(db_issue.id, new_label.name)
elsif new_label.name == old_label.name
timeline = Timeline.where(issue_id: db_issue.id, label: new_label.name).first
if timeline.nil?
new_timeline(db_issue.id, new_label.name)
end
end end
# end TODO # end TODO
...@@ -275,10 +277,18 @@ class GithubLoader ...@@ -275,10 +277,18 @@ class GithubLoader
end end
end end
def update_repo(repositories) # def update_repo(repositories)
repositories.each do |repo| # repositories.each do |repo|
end # end
# end
def new_timeline(issue_id, label)
timeline = Timeline.new
timeline.issue_id = issue_id
timeline.label = label
timeline.started_time = Time.now
timeline.save
end end
end end
...@@ -55,6 +55,62 @@ namespace :github do ...@@ -55,6 +55,62 @@ namespace :github do
$logger.info "Finished task import in #{Time.now - start_time}s" $logger.info "Finished task import in #{Time.now - start_time}s"
end end
desc "Insert github with some repositories selected before"
task insert_github_data_for_specific_repos: :environment do
loader = GithubLoader.new
start_time = Time.now
$logger.info "Begin task update " + $repos_to_update.to_s
list_db_repo = Repository.where(name: $repos_to_update)
list_db_user = User.all
list_db_label = Label.all
list_db_issue = loader.insert_issues($client, list_db_user, list_db_label, list_db_repo)
list_db_comment = loader.insert_comments($client, list_db_repo)
list_db_rv_comment = loader.insert_review_comments($client, list_db_repo)
logger.info "begin transaction"
start_time_transaction = Time.now
ActiveRecord::Base.transaction do
list_db_issue.each do |db_issue|
db_issue.save
end
list_db_comment.each do |db_comment|
db_comment.save
end
list_db_rv_comment.each do |db_rv_comment|
db_rv_comment.save
end
end
logger.info "Finished transaction in #{Time.now - start_time_transaction}s"
logger.info "Finished task update in #{Time.now - start_time}s"
end
desc "Insert Repository only"
task insert_repo_only: :environment do
loader = GithubLoader.new
$logger.info "Begin task insert repository"
list_db_repo = loader.insert_repos($client)
# list_db_user = loader.insert_users($client)
list_db_label = loader.insert_labels($client, list_db_repo)
ActiveRecord::Base.transaction do
list_db_repo.each do |db_repo|
db_repo.save
end
# list_db_user.each do |db_user|
# db_user.save
# end
list_db_label.each do |db_label|
db_label.save
end
end
$logger.info "Finished task insert repository"
end
desc "Insert comments only" desc "Insert comments only"
task insert_comment_data: :environment do task insert_comment_data: :environment do
loader = GithubLoader.new loader = GithubLoader.new
...@@ -78,8 +134,6 @@ namespace :github do ...@@ -78,8 +134,6 @@ namespace :github do
$logger.info "Finished task import comments in #{Time.now - start_time}s" $logger.info "Finished task import comments in #{Time.now - start_time}s"
end end
desc "Update issue pull association" desc "Update issue pull association"
task update_issue_pull: :environment do task update_issue_pull: :environment do
loader = GithubLoader.new loader = GithubLoader.new
......
require 'test_helper'
class SettingsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
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