diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /app/models/jira_import_state.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) | |
download | gitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/models/jira_import_state.rb')
-rw-r--r-- | app/models/jira_import_state.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/jira_import_state.rb b/app/models/jira_import_state.rb index 543ee77917c..bde2795e7b8 100644 --- a/app/models/jira_import_state.rb +++ b/app/models/jira_import_state.rb @@ -53,6 +53,7 @@ class JiraImportState < ApplicationRecord before_transition any => :finished do |state, _| InternalId.flush_records!(project: state.project) state.project.update_project_counter_caches + state.store_issue_counts end after_transition any => :finished do |state, _| @@ -80,4 +81,20 @@ class JiraImportState < ApplicationRecord def non_initial? !initial? end + + def store_issue_counts + import_label_id = Gitlab::JiraImport.get_import_label_id(project.id) + + failed_to_import_count = Gitlab::JiraImport.issue_failures(project.id) + successfully_imported_count = project.issues.with_label_ids(import_label_id).count + total_issue_count = successfully_imported_count + failed_to_import_count + + update( + { + failed_to_import_count: failed_to_import_count, + imported_issues_count: successfully_imported_count, + total_issue_count: total_issue_count + } + ) + end end |