academic_benchmarks 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: '05582989c51ab88e71317ed23866a5dd9c34a956b96791faa86f775c8c09e227'
4
- data.tar.gz: c5a713f96b930b2b914674fd57390dd68d0cc8fc9269e3b3503514637d07d746
3
+ metadata.gz: 50df986c030289fb9f248460b600eebc30b059c7386fa6c5cdeba4d39bbe714a
4
+ data.tar.gz: 4421c98acc7fbe617d2a8b1b3a8c9a4eb736d7ea65016c4ba5933a52b6f28d35
5
5
  SHA512:
6
- metadata.gz: a1cf494c1bde537ad7c8f6f6755ad71196b8946b2087479cefe4c9d5c0fee7c7f4657c14853fd8d26b01c2cd864ed8bb99e931404bd1b7c12ee1d8786b30f087
7
- data.tar.gz: bb5bfe960f0182139852c1bc27ccda0cce0ae150e81aa8682c1090390d0412b6326f0000a587d948acee8d05363a9233b5466d7c9686cf27ce6fb7e8ecf66ad0
6
+ metadata.gz: 6f777d12e41775ac0cac11b9a76922b5b10c2957e480f16c0a5ff3c61328b92abfa409389cc6e116d4d41503c8821fce2cb99e0d401bdee09ce2daea2561ab8a
7
+ data.tar.gz: cf26bcd052ff8b71be7a360ba095580f3c6993dfd235d39e57a378a846bffbfc50790654c285a829e943c638a6f069492211c4c6fe1ec3f91a2e5cc93e040970
@@ -26,6 +26,7 @@ module AcademicBenchmarks
26
26
  document.publication.guid
27
27
  document.publication.authorities
28
28
  statement.descr
29
+ utilizations.type
29
30
  parent
30
31
  ]
31
32
 
@@ -57,17 +58,17 @@ module AcademicBenchmarks
57
58
  publications(authority_guid: authority.guid)
58
59
  end
59
60
 
60
- def authority_tree(authority_or_auth_code_guid_or_desc, include_obsolete_standards: true)
61
+ def authority_tree(authority_or_auth_code_guid_or_desc, include_obsolete_standards: true, exclude_examples: false)
61
62
  authority = auth_from_code_guid_or_desc(authority_or_auth_code_guid_or_desc)
62
- auth_children = raw_search(authority: authority.guid, include_obsoletes: include_obsolete_standards)
63
+ auth_children = raw_search(authority: authority.guid, include_obsoletes: include_obsolete_standards, exclude_examples: exclude_examples)
63
64
  AcademicBenchmarks::Standards::StandardsForest.new(
64
65
  auth_children
65
66
  ).consolidate_under_root(authority)
66
67
  end
67
68
 
68
- def publication_tree(publication_or_pub_code_guid_or_desc, include_obsolete_standards: true)
69
+ def publication_tree(publication_or_pub_code_guid_or_desc, include_obsolete_standards: true, exclude_examples: false)
69
70
  publication = pub_from_guid(publication_or_pub_code_guid_or_desc)
70
- pub_children = raw_search(publication: publication.guid, include_obsoletes: include_obsolete_standards)
71
+ pub_children = raw_search(publication: publication.guid, include_obsoletes: include_obsolete_standards, exclude_examples: exclude_examples)
71
72
  AcademicBenchmarks::Standards::StandardsForest.new(
72
73
  pub_children
73
74
  ).consolidate_under_root(publication)
@@ -158,6 +159,14 @@ module AcademicBenchmarks
158
159
  end
159
160
  end
160
161
  end
162
+
163
+ if query_params.delete :exclude_examples
164
+ if query_params.key? 'filter[standards]'
165
+ query_params['filter[standards]'] += " and utilizations.type not eq 'example'"
166
+ else
167
+ query_params['filter[standards]'] = "utilizations.type not eq 'example'"
168
+ end
169
+ end
161
170
  end
162
171
 
163
172
  def request_facet(query_params)
@@ -6,6 +6,7 @@ module AcademicBenchmarks
6
6
  include InstVarsToHash
7
7
 
8
8
  attr_accessor :guid, :descr, :publication, :adopt_year, :children
9
+ alias_method :description, :descr
9
10
 
10
11
  def self.from_hash(hash)
11
12
  self.new(guid: hash["guid"], descr: hash["descr"], publication: hash["publication"], adopt_year: hash["adopt_year"])
@@ -1,8 +1,10 @@
1
+ require 'academic_benchmarks/lib/attr_to_vals'
1
2
  require 'academic_benchmarks/lib/inst_vars_to_hash'
2
3
 
3
4
  module AcademicBenchmarks
4
5
  module Standards
5
6
  class Standard
7
+ include AttrToVals
6
8
  include InstVarsToHash
7
9
 
8
10
  attr_reader :status, :children
@@ -13,6 +15,7 @@ module AcademicBenchmarks
13
15
  :seq,
14
16
  :section,
15
17
  :document, :disciplines,
18
+ :utilizations,
16
19
  :parent, :parent_guid
17
20
 
18
21
  # Before standards are rebranched in Authority#rebranch_children
@@ -37,6 +40,7 @@ module AcademicBenchmarks
37
40
  @children = []
38
41
  @document = attr_to_val_or_nil(Document, attributes, "document")
39
42
  @statement = attr_to_val_or_nil(Statement, attributes, "statement")
43
+ @utilizations = attr_to_vals(Utilizations, attributes["utilizations"])
40
44
  @parent_guid = data.dig("relationships", "parent", "data", "id")
41
45
  end
42
46
 
@@ -0,0 +1,19 @@
1
+ require 'academic_benchmarks/lib/inst_vars_to_hash'
2
+
3
+ module AcademicBenchmarks
4
+ module Standards
5
+ class Utilizations
6
+ include InstVarsToHash
7
+
8
+ attr_accessor :type
9
+
10
+ def self.from_hash(hash)
11
+ self.new(type: hash["type"])
12
+ end
13
+
14
+ def initialize(type:)
15
+ @type = type
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: academic_benchmarks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Porter
@@ -200,6 +200,7 @@ files:
200
200
  - lib/academic_benchmarks/standards/standards_tree.rb
201
201
  - lib/academic_benchmarks/standards/statement.rb
202
202
  - lib/academic_benchmarks/standards/subject.rb
203
+ - lib/academic_benchmarks/standards/utilizations.rb
203
204
  homepage: https://github.com/instructure/academic_benchmarks
204
205
  licenses:
205
206
  - AGPL-3.0