apadmi_grout 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7b05dbffa45a449751c8ce0eb6a0b8f66e2bf4ef5b9aeaa41617b3af4ea0fde
4
- data.tar.gz: b0b6bd5fbaa0459f2e76f285a521bdafc8e3317e492cd0ea7c4c58f7d5bfb8bb
3
+ metadata.gz: fe89f35f8c3b54c1f9e69bd1f0fe9d18c38ccab135960467d5df0753a4eb1fdc
4
+ data.tar.gz: '0982cf4af81f777753799820e9a0cad205f5e052f8e7ae48765b2366c61f23b3'
5
5
  SHA512:
6
- metadata.gz: 596f948aa2b574e36f3cba0ed4a596332f95f7c24d23c1f817ac1baa851e392ecb67222a7e18e871d1ab2fcd666d4f626944224bc843c576595581db68ef5281
7
- data.tar.gz: a1e727a0b3d8786525a0102cf736a9f50b04f9459edc58c81e418776b83ca913753e575152a92ac91040b98c6e920ed86140edfa43ceaaab24b42a28ec948d72
6
+ metadata.gz: ee076a7a629461753bf73c84ea78698ff7430afba999ff5c3695c80d9013dd36a4af3c1033198de37d9f610b2f0e6d1f1adab774f4c7fabd001124c3bb78be78
7
+ data.tar.gz: 28a4867d73f83d8ab6e0ab4d28c63cdbd8f166237edb28ae305325e7b029dbe6a126526f1f388ac8fc877fe298250b6a11e54bb7ecf2623cc21bcb6ffef09049
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Core Changelog
2
2
 
3
+ ## [2.5.0] - 2023-09-20
4
+ * Added more options to the ADO queries for more in granular filtering.
5
+
3
6
  ## [2.4.0] - 2023-09-04
4
7
  * No change - keeping version in sync with fastlane plugin.
5
8
 
@@ -25,11 +25,12 @@ module Apadmi
25
25
 
26
26
  # Ado specific find tickets options
27
27
  class AdoFindTicketsOptions < FindTicketsOptions
28
- attr_reader :required_tags, :not_tags
28
+ attr_reader :required_tags, :not_tags, :additional_fields
29
29
 
30
- def initialize(required_tags: [], not_tags: [])
30
+ def initialize(required_tags: [], not_tags: [], additional_fields: {})
31
31
  @required_tags = required_tags
32
32
  @not_tags = not_tags
33
+ @additional_fields = additional_fields
33
34
  end
34
35
 
35
36
  def ==(other)
@@ -37,7 +38,7 @@ module Apadmi
37
38
  end
38
39
 
39
40
  def state
40
- [@required_tags, @not_tags]
41
+ [@required_tags, @not_tags, @additional_fields]
41
42
  end
42
43
  end
43
44
  end
@@ -40,24 +40,16 @@ module Apadmi
40
40
 
41
41
  # @return [Array<Apadmi::Grout::Issue>]
42
42
  def search_unblocked_issues(component, status, ticket_types = [], options = nil)
43
- tags = (options&.required_tags || []).push(*component).filter { |it| !it.blank? }
44
- not_tags = (options&.not_tags || []).filter { |it| !it.blank? }
45
-
46
- raise "Tags can either be required or not required, not both" unless (tags & not_tags).empty?
47
-
48
- tags_filter = tags.map { |tag| " AND [System.Tags] CONTAINS '#{tag}' " }.join(" ")
49
- not_tags_filter = not_tags.map { |tag| " AND [System.Tags] NOT CONTAINS '#{tag}'" }.join(" ")
50
-
51
43
  status_filter = ("AND [System.State]='#{status}' " unless status.blank?) || ""
52
44
  type_filter = ("AND [System.WorkItemType] IN (#{ticket_types.map { |t| "'#{t}'" }.join(", ")})" unless ticket_types.empty?) || ""
45
+ options_filter = get_options_filter(component, options)
53
46
  wiql = %(
54
47
  Select [System.Id]
55
48
  From WorkItems
56
49
  Where [System.Id] >= 1
57
50
  #{status_filter}
58
- #{tags_filter}
59
- #{not_tags_filter}
60
51
  #{type_filter}
52
+ #{options_filter}
61
53
  )
62
54
 
63
55
  get_issues_by_wiql(wiql)
@@ -194,6 +186,28 @@ module Apadmi
194
186
  ids = items.map { |item| item["id"] } || []
195
187
  find_issues_by_keys(ids)
196
188
  end
189
+
190
+ # @param component [String] Included to be consistent with JIRA, this will boil down to a tag in ADO
191
+ # @param options [Apadmi::Grout::AdoFindTicketsOptions] options as defined to query
192
+
193
+ # @return [String]
194
+ def get_options_filter(component, options = nil)
195
+ tags = (options&.required_tags || []).push(*component).filter { |it| !it.blank? }
196
+ not_tags = (options&.not_tags || []).filter { |it| !it.blank? }
197
+ additional_fields = (options&.additional_fields || {}).reject { |k, _v| k.blank? }
198
+
199
+ raise "Tags can either be required or not required, not both" unless (tags & not_tags).empty?
200
+
201
+ tags_filter = tags.map { |tag| " AND [System.Tags] CONTAINS '#{tag}' " }.join(" ")
202
+ not_tags_filter = not_tags.map { |tag| " AND [System.Tags] NOT CONTAINS '#{tag}'" }.join(" ")
203
+ additional_fields_filter = additional_fields.collect { |k, v| "AND [#{k}]='#{v}'" }.join(" ")
204
+
205
+ %(
206
+ #{tags_filter}
207
+ #{not_tags_filter}
208
+ #{additional_fields_filter}
209
+ )
210
+ end
197
211
  end
198
212
  end
199
213
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Apadmi
4
4
  module Grout
5
- VERSION = "2.4.0"
5
+ VERSION = "2.5.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apadmi_grout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apadmi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-04 00:00:00.000000000 Z
11
+ date: 2023-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday