opsask 2.1.2 → 2.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79cbbbc8e1d3fa740db85a47e8994fc3104d3a0f
4
- data.tar.gz: 58ee161e52d07bf32674a6ccdbf54c3d5346956b
3
+ metadata.gz: e662cb4766ccb6a93e2428e0742130a31dc274d6
4
+ data.tar.gz: cf8bc915a2c4757032c025bd8fb0d2567c022c4e
5
5
  SHA512:
6
- metadata.gz: 5816e5221cedc00217939d90b5b8dd09e334c2857b20532514b585f2607d196575a21645bc04399e4066ab4c844373e95689e97a3e5ca4bcf0ae3b957ee1288a
7
- data.tar.gz: 253338f6357419efde0cc65e873e9bcd7e87d1ff666f81c8a05e65a5479fb13fac3e816840d122b298e4b0c042c37043ee50e5e1cda982afa3dc08bc8be3af70
6
+ metadata.gz: bbc384a84a169d75259a2635f468814afe05f143456e065c3a8a19043c8840c007885120c74cccf8436defff04cce54d57c9c7e9561009b8354fc96093e06bcb
7
+ data.tar.gz: 049e50bc925daa021be1bdc3f510fc68e530efddad4088295ca970e4be1cf6350c87efb92c47ccf4fa6ab05c29907a117e08329ad62f8ed781cb9f3db69674cc
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.1.3
data/lib/opsask/app.rb CHANGED
@@ -76,15 +76,20 @@ module OpsAsk
76
76
  "#{settings.config[:jira_url]}/issues/?jql=#{URI::escape normalized_jql("sprint = #{id} and \"Story Points\" is empty", nil)}"
77
77
  ),
78
78
  untracked_jiras: untracked_issues,
79
- stragglers: straggling_issues
79
+ stragglers: straggling_issues,
80
+ outlier_stats: {
81
+ outlier_link: outlier_link(sprint, num),
82
+ outlier_issues: outlier_issues(sprint, num)
83
+ }
80
84
  }
81
85
  end
82
86
 
83
87
  get '/sprint' do
84
88
  num = current_sprint_num
85
89
  id = current_sprint_id
90
+ sprint = current_sprint
86
91
  erb :stats, locals: {
87
- sprint: current_sprint,
92
+ sprint: sprint,
88
93
  ask_stats: stats_for(
89
94
  asks_in_current_sprint,
90
95
  "#{settings.config[:jira_url]}/issues/?jql=#{URI::escape normalized_jql("labels in (#{sprint_label_prefix}#{num}) and resolution is not empty", nil)}",
@@ -98,7 +103,11 @@ module OpsAsk
98
103
  "#{settings.config[:jira_url]}/issues/?jql=#{URI::escape normalized_jql("sprint = #{id} and \"Story Points\" is empty", nil)}"
99
104
  ),
100
105
  untracked_jiras: untracked_issues,
101
- stragglers: straggling_issues
106
+ stragglers: straggling_issues,
107
+ outlier_stats: {
108
+ outlier_link: outlier_link(sprint, num),
109
+ outlier_issues: outlier_issues(sprint, num)
110
+ }
102
111
  }
103
112
  end
104
113
 
@@ -73,6 +73,25 @@ module OpsAsk
73
73
  }
74
74
  end
75
75
 
76
+ def outlier_query sprint, num
77
+ starts = current_sprint_starts sprint
78
+ ends = current_sprint_ends sprint
79
+ normalized_jql("(sprint != #{sprint['id']} or sprint is empty) and (labels != \"#{sprint_label_prefix}#{num}\" OR labels is empty) and resolved >= \"#{starts}\" and resolved <= \"#{ends}\"")
80
+ end
81
+
82
+ def outlier_link sprint, num
83
+ "#{settings.config[:jira_url]}/issues/?jql=#{URI::escape outlier_query(sprint, num)}"
84
+ end
85
+
86
+ def outlier_issues sprint, num
87
+ return [] unless logged_in?
88
+ issues = []
89
+ @jira_client.Issue.jql(outlier_query(sprint, num), max_results: 500).each do |i|
90
+ issues << i.attrs
91
+ end
92
+ return issues
93
+ end
94
+
76
95
  def items_in_current_sprint
77
96
  items_in_sprint current_sprint_num
78
97
  end
@@ -131,9 +150,11 @@ module OpsAsk
131
150
  sprint_prefix.gsub(/\s+/, '')
132
151
  end
133
152
 
134
- def get_sprint num
135
- sprint = sprints.select { |s| s['name'] == "#{sprint_prefix} #{num}" }
136
- sprint_id = sprint.first['id']
153
+ def get_sprint num, id=nil
154
+ unless sprint_id = id
155
+ sprint = sprints.select { |s| s['name'] == "#{sprint_prefix} #{num}" }
156
+ sprint_id = sprint.first['id']
157
+ end
137
158
  url = "#{settings.config[:jira_url]}/rest/greenhopper/1.0/rapid/charts/sprintreport?rapidViewId=#{settings.config[:agile_board]}&sprintId=#{sprint_id}"
138
159
  curl_request = Curl::Easy.http_get(url) do |curl|
139
160
  curl.headers['Accept'] = 'application/json'
@@ -156,6 +177,20 @@ module OpsAsk
156
177
  return {}
157
178
  end
158
179
 
180
+ def current_sprint_starts sprint=current_sprint
181
+ if starts = sprint['startDate']
182
+ starts = DateTime.strptime(starts, '%d/%b/%y %l:%M %p')
183
+ starts.strftime('%Y/%m/%d')
184
+ end
185
+ end
186
+
187
+ def current_sprint_ends sprint=current_sprint
188
+ if ends = sprint['endDate']
189
+ ends = DateTime.strptime(ends, '%d/%b/%y %l:%M %p')
190
+ ends.strftime('%Y/%m/%d')
191
+ end
192
+ end
193
+
159
194
  def current_sprint_name sprint=current_sprint
160
195
  sprint.nil? ? nil : sprint['name'].gsub(/\s+/, '')
161
196
  end
@@ -187,8 +222,7 @@ module OpsAsk
187
222
  rescue
188
223
  $stderr.puts "Failed to parse response from JIRA: #{raw_response}"
189
224
  end
190
-
191
- return sprints.last
225
+ get_sprint(nil, sprints.last['id'])
192
226
  end
193
227
 
194
228
  def today offset=0
data/public/css/style.css CHANGED
@@ -196,4 +196,8 @@ input[type="checkbox"] + label {
196
196
  line-height: 1.5em;
197
197
  padding: 1em 0;
198
198
  text-align : center;
199
+ }
200
+
201
+ #more-stats {
202
+ text-align: center;
199
203
  }
data/views/stats.erb CHANGED
@@ -49,4 +49,15 @@
49
49
  </div>
50
50
  </div>
51
51
  </div>
52
- </div>
52
+ </div>
53
+ <!-- <%= outlier_stats[:outlier_link] %> -->
54
+ <% unless outlier_stats[:outlier_issues].empty? %>
55
+ <div class="row" id="more-stats">
56
+ <div class="small-10 columns">
57
+ <div class="small-10 small-offset-2 columns">
58
+ <a href="<%= outlier_stats[:outlier_link] %>">There <%= outlier_stats[:outlier_issues].length > 0 ? 'were' : 'was' %>
59
+ <%= pluralize outlier_stats[:outlier_issues].length, 'issues' %> unaccounted for during this sprint</a>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsask
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer