hubstats 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.markdown +5 -0
 - data/app/assets/javascripts/hubstats/users.js +4 -0
 - data/app/controllers/hubstats/qa_signoffs_controller.rb +28 -0
 - data/app/controllers/hubstats/users_controller.rb +4 -0
 - data/app/models/hubstats/pull_request.rb +1 -1
 - data/app/models/hubstats/qa_signoff.rb +49 -0
 - data/app/models/hubstats/user.rb +42 -10
 - data/app/views/hubstats/partials/_quick_stats_one.html.erb +6 -0
 - data/app/views/hubstats/partials/_quick_stats_two.html.erb +6 -0
 - data/app/views/hubstats/partials/_user.html.erb +8 -1
 - data/app/views/hubstats/tables/_users.html.erb +4 -1
 - data/app/views/hubstats/users/show.html.erb +9 -1
 - data/db/migrate/20161215163228_add_qa_signoff.rb +14 -0
 - data/db/migrate/20161215193059_signed_column_for_signoff.rb +5 -0
 - data/lib/hubstats/events_handler.rb +8 -2
 - data/lib/hubstats/version.rb +1 -1
 - data/spec/lib/hubstats/events_handler_spec.rb +3 -2
 - data/spec/models/hubstats/qa_signoff_spec.rb +19 -0
 - data/test/dummy/db/schema.rb +13 -2
 - metadata +8 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6ca209ff034e4e98eaebfb65c7fb913529a72355
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 27996253e2e5c609a77a54172fe8f500ab91f001
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b1719923f5bf0643da5c1603df631a94ece351896b7a54f8ad4b75729456654d93add03695fa9b54a865e53ba305b1881f1330ffd8c4a0bc7a642b350e845747
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c142369081e7940210c779e3831bd450171075ad5c46133d14c019bc1ed832c7a95810bf9b98faf368094d967bec09fe94914ffc636430cbc9d1abb6cce253de
         
     | 
    
        data/CHANGELOG.markdown
    CHANGED
    
    
| 
         @@ -26,6 +26,10 @@ $(document).ready(function() { 
     | 
|
| 
       26 
26 
     | 
    
         
             
                toggleOrder(queryParameters,$(this).attr('id'));
         
     | 
| 
       27 
27 
     | 
    
         
             
              });
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
              $("#signoffs").on("click", function(){
         
     | 
| 
      
 30 
     | 
    
         
            +
                toggleOrder(queryParameters,$(this).attr('id'));
         
     | 
| 
      
 31 
     | 
    
         
            +
              });
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       29 
33 
     | 
    
         
             
              $("#netadditions").on("click", function(){
         
     | 
| 
       30 
34 
     | 
    
         
             
                toggleOrder(queryParameters,$(this).attr('id'));
         
     | 
| 
       31 
35 
     | 
    
         
             
              });
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_dependency "hubstats/application_controller"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Hubstats
         
     | 
| 
      
 4 
     | 
    
         
            +
              class QaSignoffsController < Hubstats::BaseController
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                # Public - Will list all of the QA Signoffs that belong to any specific user(s)
         
     | 
| 
      
 7 
     | 
    
         
            +
                #
         
     | 
| 
      
 8 
     | 
    
         
            +
                # Returns - the QA Signoff data
         
     | 
| 
      
 9 
     | 
    
         
            +
                def index
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @qa_signoffs = Hubstats::QaSignoff.includes(:repo, :pull_request, :user)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    .belonging_to_users(params[:users])
         
     | 
| 
      
 12 
     | 
    
         
            +
                    .belonging_to_repos(params[:repos])
         
     | 
| 
      
 13 
     | 
    
         
            +
                    .group_by(params[:group])
         
     | 
| 
      
 14 
     | 
    
         
            +
                    .paginate(:page => params[:page], :per_page => 15)
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  grouping(params[:group], @qa_signoffs)
         
     | 
| 
      
 17 
     | 
    
         
            +
                end 
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                # Public - Will show the particular QA Signoff selected
         
     | 
| 
      
 20 
     | 
    
         
            +
                #
         
     | 
| 
      
 21 
     | 
    
         
            +
                # Returns - the specific details of the QA Signoff
         
     | 
| 
      
 22 
     | 
    
         
            +
                def show
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @repo = Hubstats::Repo.where(id: params[:repo_id]).first
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @pull_request = Hubstats::PullRequest.where(id: params[:pull_request_id]).first
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @user = Hubstats::User.where(id: params[:user_id]).first
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -36,6 +36,7 @@ module Hubstats 
     | 
|
| 
       36 
36 
     | 
    
         
             
                  @pull_count = Hubstats::PullRequest.belonging_to_user(@user.id).merged_in_date_range(@start_date, @end_date).count(:all)
         
     | 
| 
       37 
37 
     | 
    
         
             
                  @deploys = Hubstats::Deploy.belonging_to_user(@user.id).deployed_in_date_range(@start_date, @end_date).order("deployed_at DESC").limit(20)
         
     | 
| 
       38 
38 
     | 
    
         
             
                  @deploy_count = Hubstats::Deploy.belonging_to_user(@user.id).deployed_in_date_range(@start_date, @end_date).count(:all)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  @qa_signoff_count = Hubstats::QaSignoff.belonging_to_user(@user.id).signed_within_date_range(@start_date, @end_date).count(:all)
         
     | 
| 
       39 
40 
     | 
    
         
             
                  @comment_count = Hubstats::Comment.belonging_to_user(@user.id).created_in_date_range(@start_date, @end_date).count(:all)
         
     | 
| 
       40 
41 
     | 
    
         
             
                  @net_additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_user(@user.id).sum(:additions).to_i -
         
     | 
| 
       41 
42 
     | 
    
         
             
                                   Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_user(@user.id).sum(:deletions).to_i
         
     | 
| 
         @@ -55,6 +56,9 @@ module Hubstats 
     | 
|
| 
       55 
56 
     | 
    
         
             
                    pull_count: @pull_count,
         
     | 
| 
       56 
57 
     | 
    
         
             
                    deploy_count: @deploy_count,
         
     | 
| 
       57 
58 
     | 
    
         
             
                    comment_count: @comment_count,
         
     | 
| 
      
 59 
     | 
    
         
            +
                    qa_signoff_count: @qa_signoff_count
         
     | 
| 
      
 60 
     | 
    
         
            +
                  }
         
     | 
| 
      
 61 
     | 
    
         
            +
                  @stats_row_two = {
         
     | 
| 
       58 
62 
     | 
    
         
             
                    avg_additions: @additions.round.to_i,
         
     | 
| 
       59 
63 
     | 
    
         
             
                    avg_deletions: @deletions.round.to_i,
         
     | 
| 
       60 
64 
     | 
    
         
             
                    net_additions: @net_additions
         
     | 
| 
         @@ -161,7 +161,7 @@ module Hubstats 
     | 
|
| 
       161 
161 
     | 
    
         
             
                end
         
     | 
| 
       162 
162 
     | 
    
         | 
| 
       163 
163 
     | 
    
         
             
                # Public - Adds/remove a label based on the the webhook action
         
     | 
| 
       164 
     | 
    
         
            -
                # @param payload Webhook 
     | 
| 
      
 164 
     | 
    
         
            +
                # @param payload Webhook
         
     | 
| 
       165 
165 
     | 
    
         
             
                # @return The list of labels after the update
         
     | 
| 
       166 
166 
     | 
    
         
             
                def update_label(payload)
         
     | 
| 
       167 
167 
     | 
    
         
             
                  return unless payload[:label]
         
     | 
| 
         @@ -0,0 +1,49 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Hubstats
         
     | 
| 
      
 2 
     | 
    
         
            +
              class QaSignoff < ActiveRecord::Base
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                def self.record_timestamps; false; end
         
     | 
| 
      
 5 
     | 
    
         
            +
                
         
     | 
| 
      
 6 
     | 
    
         
            +
                # Various checks that can be used to filter, sort, and find info about QA Signoffs.
         
     | 
| 
      
 7 
     | 
    
         
            +
                scope :signed_within_date_range, lambda {|start_date, end_date| where("hubstats_qa_signoffs.signed_at BETWEEN ? AND ?", start_date, end_date)}
         
     | 
| 
      
 8 
     | 
    
         
            +
                scope :belonging_to_repo, lambda {|repo_id| where(repo_id: repo_id)}
         
     | 
| 
      
 9 
     | 
    
         
            +
                scope :belonging_to_user, lambda {|user_id| where(user_id: user_id)}
         
     | 
| 
      
 10 
     | 
    
         
            +
                scope :belonging_to_pull_request, lambda {|pr_id| where(pull_request_id: pr_id)}
         
     | 
| 
      
 11 
     | 
    
         
            +
                scope :belonging_to_repos, lambda {|repo_id| where(repo_id: repo_id.split(',')) if repo_id}
         
     | 
| 
      
 12 
     | 
    
         
            +
                scope :belonging_to_users, lambda {|user_id| where(user_id: user_id.split(',')) if user_id}
         
     | 
| 
      
 13 
     | 
    
         
            +
                scope :belonging_to_pull_requests, lambda {|pr_id| where(pull_request_id: pr_id.split(',')) if pr_id}
         
     | 
| 
      
 14 
     | 
    
         
            +
                scope :distincter, -> { select("DISTINCT hubstats_qa_signoffs.*") }
         
     | 
| 
      
 15 
     | 
    
         
            +
                scope :with_repo_name, -> { select('DISTINCT hubstats_repos.name as repo_name, hubstats_qa_signoffs.*').joins("LEFT JOIN hubstats_repos ON hubstats_repos.id = hubstats_qa_signoffs.repo_id") }
         
     | 
| 
      
 16 
     | 
    
         
            +
                scope :with_user_name, -> { select('DISTINCT hubstats_users.login as user_name, hubstats_qa_signoffs.*').joins("LEFT JOIN hubstats_users ON hubstats_users.id = hubstats_qa_signoffs.user_id") }
         
     | 
| 
      
 17 
     | 
    
         
            +
                scope :with_pull_request_name, -> { select('DISTINCT hubstats_pull_requests.title as pr_name, hubstats_qa_signoffs.*').joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.id = hubstats_qa_signoffs.pull_request_id") }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                belongs_to :user
         
     | 
| 
      
 20 
     | 
    
         
            +
                belongs_to :repo
         
     | 
| 
      
 21 
     | 
    
         
            +
                belongs_to :pull_request
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                # Public - Makes a new QA Signoff with the data that is passed in.
         
     | 
| 
      
 24 
     | 
    
         
            +
                #
         
     | 
| 
      
 25 
     | 
    
         
            +
                # repo_id - the id of the repository
         
     | 
| 
      
 26 
     | 
    
         
            +
                # pr_id - the id of the pull request
         
     | 
| 
      
 27 
     | 
    
         
            +
                # user_id - the id of the user who added the label
         
     | 
| 
      
 28 
     | 
    
         
            +
                #
         
     | 
| 
      
 29 
     | 
    
         
            +
                # Returns - the QA Signoff
         
     | 
| 
      
 30 
     | 
    
         
            +
                def self.first_or_create(repo_id, pr_id, user_id)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  QaSignoff.create(user_id: user_id,
         
     | 
| 
      
 32 
     | 
    
         
            +
                                   repo_id: repo_id,
         
     | 
| 
      
 33 
     | 
    
         
            +
                                   pull_request_id: pr_id,
         
     | 
| 
      
 34 
     | 
    
         
            +
                                   label_name: 'qa-approved',
         
     | 
| 
      
 35 
     | 
    
         
            +
                                   signed_at: Time.now.getutc)
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                # Public - Deletes the QA Signoff of the PR that is passed in.
         
     | 
| 
      
 39 
     | 
    
         
            +
                #
         
     | 
| 
      
 40 
     | 
    
         
            +
                # repo_id - the id of the repository the PR belongs to
         
     | 
| 
      
 41 
     | 
    
         
            +
                # pr_id - the id of the PR the signoff was deleted from
         
     | 
| 
      
 42 
     | 
    
         
            +
                #
         
     | 
| 
      
 43 
     | 
    
         
            +
                # Returns - the deleted QA Signoff
         
     | 
| 
      
 44 
     | 
    
         
            +
                def self.remove_signoff(repo_id, pr_id)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  signoff = Hubstats::QaSignoff.where(repo_id: repo_id).where(pull_request_id: pr_id).first
         
     | 
| 
      
 46 
     | 
    
         
            +
                  signoff.destroy if signoff
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
            end
         
     | 
    
        data/app/models/hubstats/user.rb
    CHANGED
    
    | 
         @@ -34,6 +34,19 @@ module Hubstats 
     | 
|
| 
       34 
34 
     | 
    
         
             
                   .joins(sanitize_sql_array(["LEFT JOIN hubstats_comments ON hubstats_comments.user_id = hubstats_users.id AND (hubstats_comments.created_at BETWEEN ? AND ?)", start_date, end_date]))
         
     | 
| 
       35 
35 
     | 
    
         
             
                   .group("hubstats_users.id")
         
     | 
| 
       36 
36 
     | 
    
         
             
                }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                # Public - Counts all of the QA Signoffs for selected user that were signed between the start_date and end_date.
         
     | 
| 
      
 39 
     | 
    
         
            +
                # 
         
     | 
| 
      
 40 
     | 
    
         
            +
                # start_date - the start of the date range
         
     | 
| 
      
 41 
     | 
    
         
            +
                # end_date - the end of the data range
         
     | 
| 
      
 42 
     | 
    
         
            +
                # 
         
     | 
| 
      
 43 
     | 
    
         
            +
                # Returns - count of QA Signoffs
         
     | 
| 
      
 44 
     | 
    
         
            +
                scope :qa_signoffs_count, lambda {|start_date, end_date|
         
     | 
| 
      
 45 
     | 
    
         
            +
                  select("hubstats_users.id as user_id")
         
     | 
| 
      
 46 
     | 
    
         
            +
                   .select("IFNULL(COUNT(DISTINCT hubstats_qa_signoffs.id),0) AS qa_signoff_count")
         
     | 
| 
      
 47 
     | 
    
         
            +
                   .joins(sanitize_sql_array(["LEFT JOIN hubstats_qa_signoffs ON hubstats_qa_signoffs.user_id = hubstats_users.id AND (hubstats_qa_signoffs.signed_at BETWEEN ? AND ?)", start_date, end_date]))
         
     | 
| 
      
 48 
     | 
    
         
            +
                   .group("hubstats_users.id")
         
     | 
| 
      
 49 
     | 
    
         
            +
                }
         
     | 
| 
       37 
50 
     | 
    
         | 
| 
       38 
51 
     | 
    
         
             
                # Public - Counts all of the merged pull requests for selected user that occurred between the start_date and end_date.
         
     | 
| 
       39 
52 
     | 
    
         
             
                # 
         
     | 
| 
         @@ -48,16 +61,17 @@ module Hubstats 
     | 
|
| 
       48 
61 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       49 
62 
     | 
    
         
             
                }
         
     | 
| 
       50 
63 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                # Public - Counts all of the merged pull requests, deploys, and comments that occurred between the start_date and end_date that belong to a user.
         
     | 
| 
      
 64 
     | 
    
         
            +
                # Public - Counts all of the merged pull requests, deploys, QA Signoffs, and comments that occurred between the start_date and end_date that belong to a user.
         
     | 
| 
       52 
65 
     | 
    
         
             
                #
         
     | 
| 
       53 
66 
     | 
    
         
             
                # start_date - the start of the date range
         
     | 
| 
       54 
67 
     | 
    
         
             
                # end_date - the end of the data range
         
     | 
| 
       55 
68 
     | 
    
         
             
                #
         
     | 
| 
       56 
     | 
    
         
            -
                # Returns - the count of deploys, pull requests, and comments
         
     | 
| 
      
 69 
     | 
    
         
            +
                # Returns - the count of deploys, pull requests, QA Signoffs, and comments
         
     | 
| 
       57 
70 
     | 
    
         
             
                scope :pull_comment_deploy_count, lambda {|start_date, end_date|
         
     | 
| 
       58 
     | 
    
         
            -
                  select("hubstats_users.*, pull_request_count, comment_count, deploy_count")
         
     | 
| 
      
 71 
     | 
    
         
            +
                  select("hubstats_users.*, pull_request_count, comment_count, qa_signoff_count, deploy_count")
         
     | 
| 
       59 
72 
     | 
    
         
             
                  .joins("LEFT JOIN (#{pull_requests_count(start_date, end_date).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
         
     | 
| 
       60 
73 
     | 
    
         
             
                  .joins("LEFT JOIN (#{comments_count(start_date, end_date).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
         
     | 
| 
      
 74 
     | 
    
         
            +
                  .joins("LEFT JOIN (#{qa_signoffs_count(start_date, end_date).to_sql}) AS qa_signoffs ON qa_signoffs.user_id = hubstats_users.id")
         
     | 
| 
       61 
75 
     | 
    
         
             
                  .joins("LEFT JOIN (#{deploys_count(start_date, end_date).to_sql}) AS deploys ON deploys.user_id = hubstats_users.id")
         
     | 
| 
       62 
76 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       63 
77 
     | 
    
         
             
                }
         
     | 
| 
         @@ -88,6 +102,19 @@ module Hubstats 
     | 
|
| 
       88 
102 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       89 
103 
     | 
    
         
             
                }
         
     | 
| 
       90 
104 
     | 
    
         | 
| 
      
 105 
     | 
    
         
            +
                # Public - Counts all of the QA Signoffs for selected user that were signed between the start_date and end_date and belong to the repos.
         
     | 
| 
      
 106 
     | 
    
         
            +
                # 
         
     | 
| 
      
 107 
     | 
    
         
            +
                # start_date - the start of the date range
         
     | 
| 
      
 108 
     | 
    
         
            +
                # end_date - the end of the data range
         
     | 
| 
      
 109 
     | 
    
         
            +
                # 
         
     | 
| 
      
 110 
     | 
    
         
            +
                # Returns - count of QA Signoffs
         
     | 
| 
      
 111 
     | 
    
         
            +
                scope :qa_signoffs_count_by_repo, lambda {|start_date, end_date, repo_id|
         
     | 
| 
      
 112 
     | 
    
         
            +
                  select("hubstats_users.id as user_id")
         
     | 
| 
      
 113 
     | 
    
         
            +
                  .select("COUNT(DISTINCT hubstats_qa_signoffs.id) AS qa_signoff_count")
         
     | 
| 
      
 114 
     | 
    
         
            +
                  .joins(sanitize_sql_array(["LEFT JOIN hubstats_qa_signoffs ON hubstats_qa_signoffs.user_id = hubstats_users.id AND (hubstats_qa_signoffs.signed_at BETWEEN ? AND ?) AND (hubstats_qa_signoffs.repo_id LIKE ?)", start_date, end_date, repo_id]))
         
     | 
| 
      
 115 
     | 
    
         
            +
                  .group("hubstats_users.id")
         
     | 
| 
      
 116 
     | 
    
         
            +
                }
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
       91 
118 
     | 
    
         
             
                # Public - Counts all of the pull requests for selected user that occurred between the start_date and end_date and belong to the repos.
         
     | 
| 
       92 
119 
     | 
    
         
             
                # 
         
     | 
| 
       93 
120 
     | 
    
         
             
                # start_date - the start of the date range
         
     | 
| 
         @@ -101,17 +128,18 @@ module Hubstats 
     | 
|
| 
       101 
128 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       102 
129 
     | 
    
         
             
                }
         
     | 
| 
       103 
130 
     | 
    
         | 
| 
       104 
     | 
    
         
            -
                # Public - Counts all of the merged pull requests, deploys, and comments that belong to a repository and belong to a user and occurred between 
         
     | 
| 
      
 131 
     | 
    
         
            +
                # Public - Counts all of the merged pull requests, deploys, QA Signoffs and comments that belong to a repository and belong to a user and occurred between 
         
     | 
| 
       105 
132 
     | 
    
         
             
                # the start_date and end_date.
         
     | 
| 
       106 
133 
     | 
    
         
             
                #
         
     | 
| 
       107 
134 
     | 
    
         
             
                # start_date - the start of the date range
         
     | 
| 
       108 
135 
     | 
    
         
             
                # end_date - the end of the data range
         
     | 
| 
       109 
136 
     | 
    
         
             
                #
         
     | 
| 
       110 
     | 
    
         
            -
                # Returns - the count of deploys, pull requests, and comments
         
     | 
| 
      
 137 
     | 
    
         
            +
                # Returns - the count of deploys, pull requests, QA Signoffs, and comments
         
     | 
| 
       111 
138 
     | 
    
         
             
                scope :pull_comment_deploy_count_by_repo, lambda {|start_date, end_date, repo_id|
         
     | 
| 
       112 
     | 
    
         
            -
                  select("hubstats_users.*, pull_request_count, comment_count, deploy_count")
         
     | 
| 
      
 139 
     | 
    
         
            +
                  select("hubstats_users.*, pull_request_count, comment_count, qa_signoff_count, deploy_count")
         
     | 
| 
       113 
140 
     | 
    
         
             
                  .joins("LEFT JOIN (#{pull_requests_count_by_repo(start_date, end_date, repo_id).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
         
     | 
| 
       114 
141 
     | 
    
         
             
                  .joins("LEFT JOIN (#{comments_count_by_repo(start_date, end_date, repo_id).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
         
     | 
| 
      
 142 
     | 
    
         
            +
                  .joins("LEFT JOIN (#{qa_signoffs_count_by_repo(start_date, end_date, repo_id).to_sql}) AS qa_signoffs ON qa_signoffs.user_id = hubstats_users.id")
         
     | 
| 
       115 
143 
     | 
    
         
             
                  .joins("LEFT JOIN (#{deploys_count_by_repo(start_date, end_date, repo_id).to_sql}) AS deploys ON deploys.user_id = hubstats_users.id")
         
     | 
| 
       116 
144 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       117 
145 
     | 
    
         
             
                }
         
     | 
| 
         @@ -131,7 +159,7 @@ module Hubstats 
     | 
|
| 
       131 
159 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       132 
160 
     | 
    
         
             
                }
         
     | 
| 
       133 
161 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
                # Public - Joins all of the metrics together for selected repository: average additions and deletions, comments, pull requests, and deploys.
         
     | 
| 
      
 162 
     | 
    
         
            +
                # Public - Joins all of the metrics together for selected repository: average additions and deletions, comments, pull requests, QA Signoffs and deploys.
         
     | 
| 
       135 
163 
     | 
    
         
             
                # However, will only count those that also have something to do with the repos passed in.
         
     | 
| 
       136 
164 
     | 
    
         
             
                # 
         
     | 
| 
       137 
165 
     | 
    
         
             
                # start_date - the start of the date range
         
     | 
| 
         @@ -139,25 +167,27 @@ module Hubstats 
     | 
|
| 
       139 
167 
     | 
    
         
             
                # 
         
     | 
| 
       140 
168 
     | 
    
         
             
                # Returns - all of the stats about the user
         
     | 
| 
       141 
169 
     | 
    
         
             
                scope :with_all_metrics_repos, lambda {|start_date, end_date, repos|
         
     | 
| 
       142 
     | 
    
         
            -
                  select("hubstats_users.*, deploy_count, pull_request_count, comment_count, additions, deletions")
         
     | 
| 
      
 170 
     | 
    
         
            +
                  select("hubstats_users.*, deploy_count, pull_request_count, comment_count, qa_signoff_count, additions, deletions")
         
     | 
| 
       143 
171 
     | 
    
         
             
                  .joins("LEFT JOIN (#{net_additions_count(start_date, end_date).to_sql}) AS net_additions ON net_additions.user_id = hubstats_users.id")
         
     | 
| 
       144 
172 
     | 
    
         
             
                  .joins("LEFT JOIN (#{pull_requests_count_by_repo(start_date, end_date, repos).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
         
     | 
| 
       145 
173 
     | 
    
         
             
                  .joins("LEFT JOIN (#{comments_count_by_repo(start_date, end_date, repos).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
         
     | 
| 
      
 174 
     | 
    
         
            +
                  .joins("LEFT JOIN (#{qa_signoffs_count_by_repo(start_date, end_date, repos).to_sql} AS qa_signoffs ON qa_signoffs.user_id = hubstats_users.id")
         
     | 
| 
       146 
175 
     | 
    
         
             
                  .joins("LEFT JOIN (#{deploys_count_by_repo(start_date, end_date, repos).to_sql}) AS deploys ON deploys.user_id = hubstats_users.id")
         
     | 
| 
       147 
176 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       148 
177 
     | 
    
         
             
                }
         
     | 
| 
       149 
178 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
                # Public - Joins all of the metrics together for selected user: average additions and deletions, comments, pull requests, and deploys.
         
     | 
| 
      
 179 
     | 
    
         
            +
                # Public - Joins all of the metrics together for selected user: average additions and deletions, comments, pull requests, QA Signoffs and deploys.
         
     | 
| 
       151 
180 
     | 
    
         
             
                # 
         
     | 
| 
       152 
181 
     | 
    
         
             
                # start_date - the start of the date range
         
     | 
| 
       153 
182 
     | 
    
         
             
                # end_date - the end of the data range
         
     | 
| 
       154 
183 
     | 
    
         
             
                # 
         
     | 
| 
       155 
184 
     | 
    
         
             
                # Returns - all of the stats about the user
         
     | 
| 
       156 
185 
     | 
    
         
             
                scope :with_all_metrics, lambda {|start_date, end_date|
         
     | 
| 
       157 
     | 
    
         
            -
                  select("hubstats_users.*, deploy_count, pull_request_count, comment_count, additions, deletions")
         
     | 
| 
      
 186 
     | 
    
         
            +
                  select("hubstats_users.*, deploy_count, pull_request_count, comment_count, qa_signoff_count, additions, deletions")
         
     | 
| 
       158 
187 
     | 
    
         
             
                  .joins("LEFT JOIN (#{net_additions_count(start_date, end_date).to_sql}) AS net_additions ON net_additions.user_id = hubstats_users.id")
         
     | 
| 
       159 
188 
     | 
    
         
             
                  .joins("LEFT JOIN (#{pull_requests_count(start_date, end_date).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
         
     | 
| 
       160 
189 
     | 
    
         
             
                  .joins("LEFT JOIN (#{comments_count(start_date, end_date).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
         
     | 
| 
      
 190 
     | 
    
         
            +
                  .joins("LEFT JOIN (#{qa_signoffs_count(start_date, end_date).to_sql}) AS qa_signoffs ON qa_signoffs.user_id = hubstats_users.id")
         
     | 
| 
       161 
191 
     | 
    
         
             
                  .joins("LEFT JOIN (#{deploys_count(start_date, end_date).to_sql}) AS deploys ON deploys.user_id = hubstats_users.id")
         
     | 
| 
       162 
192 
     | 
    
         
             
                  .group("hubstats_users.id")
         
     | 
| 
       163 
193 
     | 
    
         
             
                }
         
     | 
| 
         @@ -219,6 +249,8 @@ module Hubstats 
     | 
|
| 
       219 
249 
     | 
    
         
             
                      order("pull_request_count #{order}")
         
     | 
| 
       220 
250 
     | 
    
         
             
                    when 'comments'
         
     | 
| 
       221 
251 
     | 
    
         
             
                      order("comment_count #{order}")
         
     | 
| 
      
 252 
     | 
    
         
            +
                    when 'signoffs'
         
     | 
| 
      
 253 
     | 
    
         
            +
                      order("qa_signoff_count #{order}")
         
     | 
| 
       222 
254 
     | 
    
         
             
                    when 'netadditions'
         
     | 
| 
       223 
255 
     | 
    
         
             
                      order("additions - deletions #{order}")
         
     | 
| 
       224 
256 
     | 
    
         
             
                    when 'name'
         
     | 
| 
         @@ -43,6 +43,12 @@ 
     | 
|
| 
       43 
43 
     | 
    
         
             
                <h4> Comments </h4>
         
     | 
| 
       44 
44 
     | 
    
         
             
              </div>
         
     | 
| 
       45 
45 
     | 
    
         
             
            <% end %>
         
     | 
| 
      
 46 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :qa_signoff_count %>
         
     | 
| 
      
 47 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 48 
     | 
    
         
            +
                <h1><%= @stats_row_one[:qa_signoff_count] %> </h1>
         
     | 
| 
      
 49 
     | 
    
         
            +
                <h4> QA Signoffs </h4>
         
     | 
| 
      
 50 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 51 
     | 
    
         
            +
            <% end %>
         
     | 
| 
       46 
52 
     | 
    
         
             
            <% if @stats_row_one.has_key? :review_count %>
         
     | 
| 
       47 
53 
     | 
    
         
             
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
       48 
54 
     | 
    
         
             
                 <h1> <%= @stats_row_one[:review_count] %> </h1>
         
     | 
| 
         @@ -43,6 +43,12 @@ 
     | 
|
| 
       43 
43 
     | 
    
         
             
                <h4> Comments </h4>
         
     | 
| 
       44 
44 
     | 
    
         
             
              </div>
         
     | 
| 
       45 
45 
     | 
    
         
             
            <% end %>
         
     | 
| 
      
 46 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :qa_signoff_count %>
         
     | 
| 
      
 47 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 48 
     | 
    
         
            +
                <h1><%= @stats_row_one[:qa_signoff_count] %> </h1>
         
     | 
| 
      
 49 
     | 
    
         
            +
                <h4> QA Signoffs </h4>
         
     | 
| 
      
 50 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 51 
     | 
    
         
            +
            <% end %>
         
     | 
| 
       46 
52 
     | 
    
         
             
            <% if @stats_row_two.has_key? :review_count %>
         
     | 
| 
       47 
53 
     | 
    
         
             
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
       48 
54 
     | 
    
         
             
                 <h1> <%= @stats_row_two[:review_count] %> </h1>
         
     | 
| 
         @@ -4,7 +4,7 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
              <div class="user-image col-lg-1 col-md-1 col-sm-1" >
         
     | 
| 
       5 
5 
     | 
    
         
             
                <img src= <%= user.avatar_url%> alt= <%= user.login %> >
         
     | 
| 
       6 
6 
     | 
    
         
             
              </div>
         
     | 
| 
       7 
     | 
    
         
            -
              <div class="user-info col-lg- 
     | 
| 
      
 7 
     | 
    
         
            +
              <div class="user-info col-lg-2 col-md-2 col-sm-2">
         
     | 
| 
       8 
8 
     | 
    
         
             
                <h4> 
         
     | 
| 
       9 
9 
     | 
    
         
             
                  <%= link_to user.login, user_path(user) %>
         
     | 
| 
       10 
10 
     | 
    
         
             
                </h4>
         
     | 
| 
         @@ -38,6 +38,13 @@ 
     | 
|
| 
       38 
38 
     | 
    
         
             
                </div>
         
     | 
| 
       39 
39 
     | 
    
         
             
              </div>
         
     | 
| 
       40 
40 
     | 
    
         
             
              <div class="col-lg-2 col-md-2 col-sm-2">
         
     | 
| 
      
 41 
     | 
    
         
            +
                <div class="text-center">
         
     | 
| 
      
 42 
     | 
    
         
            +
                  <span class="text-large"><%= user.qa_signoff_count %></span>
         
     | 
| 
      
 43 
     | 
    
         
            +
                  <span class="mega-octicon octicon-checklist"></span>
         
     | 
| 
      
 44 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 45 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              <div class="col-lg-1 col-md-1 col-sm-1">
         
     | 
| 
       41 
48 
     | 
    
         
             
                <div class="text-center">
         
     | 
| 
       42 
49 
     | 
    
         
             
                  <span class="text-large"><%= user.additions - user.deletions %></span>
         
     | 
| 
       43 
50 
     | 
    
         
             
                </div>
         
     | 
| 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            <% if @users.length > 0 %>
         
     | 
| 
       3 
3 
     | 
    
         
             
              <div class="users">
         
     | 
| 
       4 
4 
     | 
    
         
             
                <div class="row single-user header">
         
     | 
| 
       5 
     | 
    
         
            -
                  <div class="col-lg- 
     | 
| 
      
 5 
     | 
    
         
            +
                  <div class="col-lg-3 col-md-3 col-sm-3">
         
     | 
| 
       6 
6 
     | 
    
         
             
                    <a class="header desc" id="name"> GitHub Username <span class="octicon"></span> </a>
         
     | 
| 
       7 
7 
     | 
    
         
             
                  </div>
         
     | 
| 
       8 
8 
     | 
    
         
             
                  <div class="col-lg-2 col-md-2 col-sm-2">
         
     | 
| 
         @@ -15,6 +15,9 @@ 
     | 
|
| 
       15 
15 
     | 
    
         
             
                    <a class="header desc" id="comments"> Comments <span class="octicon"></span></a>
         
     | 
| 
       16 
16 
     | 
    
         
             
                  </div>
         
     | 
| 
       17 
17 
     | 
    
         
             
                  <div class="col-lg-2 col-md-2 col-sm-2">
         
     | 
| 
      
 18 
     | 
    
         
            +
                    <a class="header desc" id="signoffs"> QA Signoffs <span class="octicon"></span></a>
         
     | 
| 
      
 19 
     | 
    
         
            +
                  </div>
         
     | 
| 
      
 20 
     | 
    
         
            +
                  <div class="col-lg-1 col-md-1 col-sm-1">
         
     | 
| 
       18 
21 
     | 
    
         
             
                    <a class="header desc" id="netadditions"> Net Additions <span class="octicon"></span></a>
         
     | 
| 
       19 
22 
     | 
    
         
             
                  </div>
         
     | 
| 
       20 
23 
     | 
    
         
             
                </div>
         
     | 
| 
         @@ -14,7 +14,15 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
                </h4>
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                <!-- Show all of the stats about the user -->
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_one' %>    
         
     | 
| 
      
 19 
     | 
    
         
            +
                <br>
         
     | 
| 
      
 20 
     | 
    
         
            +
                <br>
         
     | 
| 
      
 21 
     | 
    
         
            +
                <br>
         
     | 
| 
      
 22 
     | 
    
         
            +
                <br>
         
     | 
| 
      
 23 
     | 
    
         
            +
                <br>
         
     | 
| 
      
 24 
     | 
    
         
            +
                <br>
         
     | 
| 
      
 25 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_two' %>
         
     | 
| 
       18 
26 
     | 
    
         
             
              </div>
         
     | 
| 
       19 
27 
     | 
    
         | 
| 
       20 
28 
     | 
    
         
             
              <div class="row">
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class AddQaSignoff < ActiveRecord::Migration
         
     | 
| 
      
 2 
     | 
    
         
            +
              def change
         
     | 
| 
      
 3 
     | 
    
         
            +
                create_table :hubstats_qa_signoffs do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  t.belongs_to :user
         
     | 
| 
      
 5 
     | 
    
         
            +
                  t.belongs_to :repo
         
     | 
| 
      
 6 
     | 
    
         
            +
                  t.belongs_to :pull_request
         
     | 
| 
      
 7 
     | 
    
         
            +
                  t.string :label_name
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                add_index :hubstats_qa_signoffs, :user_id
         
     | 
| 
      
 11 
     | 
    
         
            +
                add_index :hubstats_qa_signoffs, :repo_id
         
     | 
| 
      
 12 
     | 
    
         
            +
                add_index :hubstats_qa_signoffs, :pull_request_id
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -22,7 +22,8 @@ module Hubstats 
     | 
|
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                # Public - Gets the information for the PR, creates/updates the new PR, grabs the labels, and makes new labels
         
     | 
| 
      
 25 
     | 
    
         
            +
                # Public - Gets the information for the PR, creates/updates the new PR, grabs the labels, and makes new labels;
         
     | 
| 
      
 26 
     | 
    
         
            +
                #  if the label qa-approved is added or removed, a new QA Signoff record will be made
         
     | 
| 
       26 
27 
     | 
    
         
             
                #
         
     | 
| 
       27 
28 
     | 
    
         
             
                # payload - the information that we will use to get data off of
         
     | 
| 
       28 
29 
     | 
    
         
             
                #
         
     | 
| 
         @@ -31,7 +32,12 @@ module Hubstats 
     | 
|
| 
       31 
32 
     | 
    
         
             
                  pull_request = payload[:pull_request]
         
     | 
| 
       32 
33 
     | 
    
         
             
                  pull_request[:repository] = payload[:repository]
         
     | 
| 
       33 
34 
     | 
    
         
             
                  new_pull = Hubstats::PullRequest.create_or_update(pull_request.with_indifferent_access)
         
     | 
| 
       34 
     | 
    
         
            -
                  if payload[: 
     | 
| 
      
 35 
     | 
    
         
            +
                  if payload[:github_action].include?('labeled')
         
     | 
| 
      
 36 
     | 
    
         
            +
                    if payload[:github_action].include?('unlabeled') && payload[:label][:name].include?('qa-approved')
         
     | 
| 
      
 37 
     | 
    
         
            +
                      Hubstats::QaSignoff.remove_signoff(payload[:repository][:id], payload[:pull_request][:id])
         
     | 
| 
      
 38 
     | 
    
         
            +
                    elsif payload[:label][:name].include?('qa-approved')
         
     | 
| 
      
 39 
     | 
    
         
            +
                      Hubstats::QaSignoff.first_or_create(payload[:repository][:id], payload[:pull_request][:id], payload[:sender][:id])
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
       35 
41 
     | 
    
         
             
                    new_pull.update_label(payload)
         
     | 
| 
       36 
42 
     | 
    
         
             
                  else
         
     | 
| 
       37 
43 
     | 
    
         
             
                    repo_name = Hubstats::Repo.where(id: new_pull.repo_id).first.full_name
         
     | 
    
        data/lib/hubstats/version.rb
    CHANGED
    
    
| 
         @@ -15,6 +15,7 @@ module Hubstats 
     | 
|
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                  it 'should add labels to pull request' do
         
     | 
| 
      
 18 
     | 
    
         
            +
                    payload[:github_action] = 'created'
         
     | 
| 
       18 
19 
     | 
    
         
             
                    allow(PullRequest).to receive(:create_or_update) {pull}
         
     | 
| 
       19 
20 
     | 
    
         
             
                    allow(Repo).to receive(:where) {[repo,repo]}
         
     | 
| 
       20 
21 
     | 
    
         
             
                    allow(GithubAPI).to receive(:get_labels_for_pull) {[{name: 'low'}, {name: 'high'}]}
         
     | 
| 
         @@ -23,7 +24,7 @@ module Hubstats 
     | 
|
| 
       23 
24 
     | 
    
         
             
                  end
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
26 
     | 
    
         
             
                  it 'should add new labels to pull requests' do
         
     | 
| 
       26 
     | 
    
         
            -
                    payload[: 
     | 
| 
      
 27 
     | 
    
         
            +
                    payload[:github_action] = 'labeled'
         
     | 
| 
       27 
28 
     | 
    
         
             
                    payload[:label] = {name: 'new_label'}
         
     | 
| 
       28 
29 
     | 
    
         
             
                    allow(PullRequest).to receive(:create_or_update) {pull}
         
     | 
| 
       29 
30 
     | 
    
         
             
                    allow(Repo).to receive(:where) {[repo,repo]}
         
     | 
| 
         @@ -33,7 +34,7 @@ module Hubstats 
     | 
|
| 
       33 
34 
     | 
    
         
             
                  end
         
     | 
| 
       34 
35 
     | 
    
         | 
| 
       35 
36 
     | 
    
         
             
                  it 'should remove old labels from pull requests' do
         
     | 
| 
       36 
     | 
    
         
            -
                    payload[: 
     | 
| 
      
 37 
     | 
    
         
            +
                    payload[:github_action] = 'unlabeled'
         
     | 
| 
       37 
38 
     | 
    
         
             
                    payload[:label] = {name: 'old_label'}
         
     | 
| 
       38 
39 
     | 
    
         
             
                    allow(PullRequest).to receive(:create_or_update) {pull}
         
     | 
| 
       39 
40 
     | 
    
         
             
                    allow(Repo).to receive(:where) {[repo,repo]}
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Hubstats
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe QaSignoff, :type => :model do
         
     | 
| 
      
 5 
     | 
    
         
            +
                it 'should create and return a QA Signoff' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  signoff = QaSignoff.first_or_create(123, 456, 789)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  expect(signoff.user_id).to eq(789)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  expect(signoff.repo_id).to eq(123)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  expect(signoff.pull_request_id).to eq(456)
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                it 'should remove a signoff' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  signoff = QaSignoff.first_or_create(123, 456, 789)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  expect(Hubstats::QaSignoff.where(pull_request_id: 456).count).to eq(1)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  QaSignoff.remove_signoff(123, 456)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(Hubstats::QaSignoff.where(pull_request_id: 456)).to eq([])
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
    
        data/test/dummy/db/schema.rb
    CHANGED
    
    | 
         @@ -11,14 +11,13 @@ 
     | 
|
| 
       11 
11 
     | 
    
         
             
            #
         
     | 
| 
       12 
12 
     | 
    
         
             
            # It's strongly recommended that you check this file into your version control system.
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
            ActiveRecord::Schema.define(version:  
     | 
| 
      
 14 
     | 
    
         
            +
            ActiveRecord::Schema.define(version: 20161215193314) do
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              create_table "hubstats_comments", force: :cascade do |t|
         
     | 
| 
       17 
17 
     | 
    
         
             
                t.string   "html_url",         limit: 255
         
     | 
| 
       18 
18 
     | 
    
         
             
                t.string   "url",              limit: 255
         
     | 
| 
       19 
19 
     | 
    
         
             
                t.string   "pull_request_url", limit: 255
         
     | 
| 
       20 
20 
     | 
    
         
             
                t.integer  "path",             limit: 4
         
     | 
| 
       21 
     | 
    
         
            -
                t.string   "body_string",      limit: 255
         
     | 
| 
       22 
21 
     | 
    
         
             
                t.string   "kind",             limit: 255
         
     | 
| 
       23 
22 
     | 
    
         
             
                t.integer  "user_id",          limit: 4
         
     | 
| 
       24 
23 
     | 
    
         
             
                t.integer  "pull_request_id",  limit: 4
         
     | 
| 
         @@ -82,6 +81,18 @@ ActiveRecord::Schema.define(version: 20160113182419) do 
     | 
|
| 
       82 
81 
     | 
    
         
             
              add_index "hubstats_pull_requests", ["team_id"], name: "index_hubstats_pull_requests_on_team_id", using: :btree
         
     | 
| 
       83 
82 
     | 
    
         
             
              add_index "hubstats_pull_requests", ["user_id"], name: "index_hubstats_pull_requests_on_user_id", using: :btree
         
     | 
| 
       84 
83 
     | 
    
         | 
| 
      
 84 
     | 
    
         
            +
              create_table "hubstats_qa_signoffs", force: :cascade do |t|
         
     | 
| 
      
 85 
     | 
    
         
            +
                t.integer  "user_id",         limit: 4
         
     | 
| 
      
 86 
     | 
    
         
            +
                t.integer  "repo_id",         limit: 4
         
     | 
| 
      
 87 
     | 
    
         
            +
                t.integer  "pull_request_id", limit: 4
         
     | 
| 
      
 88 
     | 
    
         
            +
                t.string   "label_name",      limit: 255
         
     | 
| 
      
 89 
     | 
    
         
            +
                t.datetime "signed_at"
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              add_index "hubstats_qa_signoffs", ["pull_request_id"], name: "index_hubstats_qa_signoffs_on_pull_request_id", using: :btree
         
     | 
| 
      
 93 
     | 
    
         
            +
              add_index "hubstats_qa_signoffs", ["repo_id"], name: "index_hubstats_qa_signoffs_on_repo_id", using: :btree
         
     | 
| 
      
 94 
     | 
    
         
            +
              add_index "hubstats_qa_signoffs", ["user_id"], name: "index_hubstats_qa_signoffs_on_user_id", using: :btree
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
       85 
96 
     | 
    
         
             
              create_table "hubstats_repos", force: :cascade do |t|
         
     | 
| 
       86 
97 
     | 
    
         
             
                t.string   "name",       limit: 255
         
     | 
| 
       87 
98 
     | 
    
         
             
                t.string   "full_name",  limit: 255
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hubstats
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.9.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Elliot Hursh
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2016-12- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2016-12-22 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -226,6 +226,7 @@ files: 
     | 
|
| 
       226 
226 
     | 
    
         
             
            - app/controllers/hubstats/deploys_controller.rb
         
     | 
| 
       227 
227 
     | 
    
         
             
            - app/controllers/hubstats/events_controller.rb
         
     | 
| 
       228 
228 
     | 
    
         
             
            - app/controllers/hubstats/pull_requests_controller.rb
         
     | 
| 
      
 229 
     | 
    
         
            +
            - app/controllers/hubstats/qa_signoffs_controller.rb
         
     | 
| 
       229 
230 
     | 
    
         
             
            - app/controllers/hubstats/repos_controller.rb
         
     | 
| 
       230 
231 
     | 
    
         
             
            - app/controllers/hubstats/teams_controller.rb
         
     | 
| 
       231 
232 
     | 
    
         
             
            - app/controllers/hubstats/users_controller.rb
         
     | 
| 
         @@ -239,6 +240,7 @@ files: 
     | 
|
| 
       239 
240 
     | 
    
         
             
            - app/models/hubstats/deploy.rb
         
     | 
| 
       240 
241 
     | 
    
         
             
            - app/models/hubstats/label.rb
         
     | 
| 
       241 
242 
     | 
    
         
             
            - app/models/hubstats/pull_request.rb
         
     | 
| 
      
 243 
     | 
    
         
            +
            - app/models/hubstats/qa_signoff.rb
         
     | 
| 
       242 
244 
     | 
    
         
             
            - app/models/hubstats/repo.rb
         
     | 
| 
       243 
245 
     | 
    
         
             
            - app/models/hubstats/team.rb
         
     | 
| 
       244 
246 
     | 
    
         
             
            - app/models/hubstats/user.rb
         
     | 
| 
         @@ -302,6 +304,8 @@ files: 
     | 
|
| 
       302 
304 
     | 
    
         
             
            - db/migrate/20160113181700_copy_body_string_to_body_text.rb
         
     | 
| 
       303 
305 
     | 
    
         
             
            - db/migrate/20160113182307_rename_body_to_body_string.rb
         
     | 
| 
       304 
306 
     | 
    
         
             
            - db/migrate/20160113182356_rename_body_text_to_body.rb
         
     | 
| 
      
 307 
     | 
    
         
            +
            - db/migrate/20161215163228_add_qa_signoff.rb
         
     | 
| 
      
 308 
     | 
    
         
            +
            - db/migrate/20161215193059_signed_column_for_signoff.rb
         
     | 
| 
       305 
309 
     | 
    
         
             
            - db/seeds.rb
         
     | 
| 
       306 
310 
     | 
    
         
             
            - hubstats.gemspec
         
     | 
| 
       307 
311 
     | 
    
         
             
            - lib/generators/hubstats/install_generator.rb
         
     | 
| 
         @@ -339,6 +343,7 @@ files: 
     | 
|
| 
       339 
343 
     | 
    
         
             
            - spec/models/hubstats/deploy_spec.rb
         
     | 
| 
       340 
344 
     | 
    
         
             
            - spec/models/hubstats/label_spec.rb
         
     | 
| 
       341 
345 
     | 
    
         
             
            - spec/models/hubstats/pull_request_spec.rb
         
     | 
| 
      
 346 
     | 
    
         
            +
            - spec/models/hubstats/qa_signoff_spec.rb
         
     | 
| 
       342 
347 
     | 
    
         
             
            - spec/models/hubstats/repo_spec.rb
         
     | 
| 
       343 
348 
     | 
    
         
             
            - spec/models/hubstats/team_spec.rb
         
     | 
| 
       344 
349 
     | 
    
         
             
            - spec/models/hubstats/user_spec.rb
         
     | 
| 
         @@ -427,6 +432,7 @@ test_files: 
     | 
|
| 
       427 
432 
     | 
    
         
             
            - spec/models/hubstats/deploy_spec.rb
         
     | 
| 
       428 
433 
     | 
    
         
             
            - spec/models/hubstats/label_spec.rb
         
     | 
| 
       429 
434 
     | 
    
         
             
            - spec/models/hubstats/pull_request_spec.rb
         
     | 
| 
      
 435 
     | 
    
         
            +
            - spec/models/hubstats/qa_signoff_spec.rb
         
     | 
| 
       430 
436 
     | 
    
         
             
            - spec/models/hubstats/repo_spec.rb
         
     | 
| 
       431 
437 
     | 
    
         
             
            - spec/models/hubstats/team_spec.rb
         
     | 
| 
       432 
438 
     | 
    
         
             
            - spec/models/hubstats/user_spec.rb
         
     |