quby-compiler 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +11 -11
- data/lib/quby/compiler/entities/outcome_table.rb +12 -0
- data/lib/quby/compiler/outputs/roqua_serializer.rb +38 -2
- data/lib/quby/compiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a56013c91225af82fd15a27e8195ca88b22dcb3ea94354ab2ef62cef50532bf2
|
4
|
+
data.tar.gz: 6412e7e3ef45dd548dc10eea9e2b72da4b7cc64d94d9de2a3ede13db70c5be25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67d746a71ccbd1c0780a836579000efdf50e825a10906a10992abaf3612340039e9670320814d6cb7f6baf3eb041e85c3872496e4d95a70ed4195d61632b969a
|
7
|
+
data.tar.gz: 51151607042665ecbdd7f4b9448e24a220350cd132ec1e5ef509dfd71b5abca5668686de5231cfd40a27e43ecead4003e1f41ab04e01f952fae95ecc3f96a7cf
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 0.3.6
|
2
|
+
|
3
|
+
* `outcome_table` panel dsl method now exports the given outcome table definition to `roqua.json`
|
4
|
+
This can't be used in combination with the `outcome_table: ` attibute in score schemas.
|
5
|
+
|
1
6
|
# 0.3.5
|
2
7
|
|
3
8
|
* Allow score_schema's outcome_table to be set to nil to hide values from outcome tables
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
quby-compiler (0.3.
|
4
|
+
quby-compiler (0.3.5)
|
5
5
|
actionview (>= 5.0)
|
6
6
|
activemodel (>= 5.0)
|
7
7
|
activesupport (>= 5.0)
|
@@ -21,8 +21,8 @@ GEM
|
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
active_interaction (
|
25
|
-
activemodel (>=
|
24
|
+
active_interaction (4.0.2)
|
25
|
+
activemodel (>= 5, < 7)
|
26
26
|
activemodel (6.0.4)
|
27
27
|
activesupport (= 6.0.4)
|
28
28
|
activerecord (6.0.4)
|
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
minitest (~> 5.1)
|
35
35
|
tzinfo (~> 1.1)
|
36
36
|
zeitwerk (~> 2.2, >= 2.2.2)
|
37
|
-
appsignal (
|
37
|
+
appsignal (3.0.8)
|
38
38
|
rack
|
39
39
|
builder (3.2.4)
|
40
40
|
coderay (1.1.3)
|
@@ -44,13 +44,13 @@ GEM
|
|
44
44
|
dry-configurable (0.12.1)
|
45
45
|
concurrent-ruby (~> 1.0)
|
46
46
|
dry-core (~> 0.5, >= 0.5.0)
|
47
|
-
dry-container (0.
|
47
|
+
dry-container (0.8.0)
|
48
48
|
concurrent-ruby (~> 1.0)
|
49
49
|
dry-configurable (~> 0.1, >= 0.1.3)
|
50
|
-
dry-core (0.
|
50
|
+
dry-core (0.6.0)
|
51
51
|
concurrent-ruby (~> 1.0)
|
52
52
|
dry-inflector (0.2.0)
|
53
|
-
dry-logic (1.
|
53
|
+
dry-logic (1.2.0)
|
54
54
|
concurrent-ruby (~> 1.0)
|
55
55
|
dry-core (~> 0.5, >= 0.5)
|
56
56
|
dry-struct (1.4.0)
|
@@ -91,10 +91,10 @@ GEM
|
|
91
91
|
loofah (~> 2.3)
|
92
92
|
rake (12.3.3)
|
93
93
|
redcarpet (3.5.1)
|
94
|
-
roqua-support (0.
|
95
|
-
active_interaction (
|
96
|
-
activesupport (>= 5.
|
97
|
-
appsignal (>= 2.9, <
|
94
|
+
roqua-support (0.4.0)
|
95
|
+
active_interaction (>= 3.0, < 5.0)
|
96
|
+
activesupport (>= 5.2, < 6.2)
|
97
|
+
appsignal (>= 2.9, < 3.1)
|
98
98
|
naught (~> 1.0)
|
99
99
|
with_advisory_lock (~> 3.2)
|
100
100
|
rspec (3.9.0)
|
@@ -15,6 +15,7 @@ module Quby
|
|
15
15
|
validates :score_keys, :subscore_keys, :questionnaire, :key, presence: true
|
16
16
|
validates :name, presence: true, if: proc { |table| table.default_collapsed }
|
17
17
|
validate :references_existing_score_keys
|
18
|
+
validate :no_outcome_tables_defined_in_score_schemas
|
18
19
|
|
19
20
|
def references_existing_score_keys
|
20
21
|
(score_keys - questionnaire.score_schemas.values.map(&:key)).each do |missing_key|
|
@@ -25,6 +26,17 @@ module Quby
|
|
25
26
|
errors.add :subscore_keys, "#{missing_key.inspect} not found in subscore schemas"
|
26
27
|
end
|
27
28
|
end
|
29
|
+
|
30
|
+
def no_outcome_tables_defined_in_score_schemas
|
31
|
+
if questionnaire.score_schemas.values.any? do |schema|
|
32
|
+
schema.subscore_schemas.any? do |subscore|
|
33
|
+
subscore.outcome_table != :main
|
34
|
+
end
|
35
|
+
end
|
36
|
+
errors.add :score_schemas,
|
37
|
+
"Outcome table associations defined in score schemas should not be combined with explicit outcome tables"
|
38
|
+
end
|
39
|
+
end
|
28
40
|
end
|
29
41
|
end
|
30
42
|
end
|
@@ -84,11 +84,47 @@ module Quby
|
|
84
84
|
# <subscore_key:Symbol>: <subscore.label:String> # headers for each subscore key for all tables.
|
85
85
|
|
86
86
|
def outcome_tables_schema
|
87
|
+
if questionnaire.outcome_tables.present?
|
88
|
+
outcome_tables_from_definition
|
89
|
+
else
|
90
|
+
outcome_tables_from_score_schemas
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def outcome_tables_from_definition
|
95
|
+
# hash of tables, with the score keys (rows) and subscore keys (columns) used for each
|
96
|
+
tables = {}
|
97
|
+
# hash of `subscore_key: subscore_label` pairs used in tables
|
98
|
+
headers = {}
|
99
|
+
|
100
|
+
questionnaire.outcome_tables.each do |table|
|
101
|
+
tables[table.key] = {name: table.name,
|
102
|
+
default_collapsed: table.default_collapsed,
|
103
|
+
score_keys: table.score_keys,
|
104
|
+
subscore_keys: table.subscore_keys}.compact
|
105
|
+
|
106
|
+
table.subscore_keys.each do |subscore_key|
|
107
|
+
table.score_keys.find do |score_key|
|
108
|
+
subschema = questionnaire.score_schemas[score_key].subscore_schemas.find do |subschema|
|
109
|
+
subschema.key == subscore_key
|
110
|
+
end
|
111
|
+
headers[subscore_key] = subschema&.label
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
{
|
117
|
+
headers: headers,
|
118
|
+
tables: tables,
|
119
|
+
}
|
120
|
+
end
|
121
|
+
|
122
|
+
def outcome_tables_from_score_schemas
|
87
123
|
# hash of tables, with the score keys (rows) and subscore keys (columns) used for each
|
88
124
|
tables = Hash.new{ |hash, key| hash[key] = {score_keys: Set.new, subscore_keys: Set.new } }
|
89
125
|
# hash of `subscore_key: subscore_label` pairs used in tables
|
90
126
|
headers = {}
|
91
|
-
|
127
|
+
|
92
128
|
questionnaire.score_schemas.values.each do |schema|
|
93
129
|
schema.subscore_schemas.each do |subschema|
|
94
130
|
next if subschema.outcome_table.blank?
|
@@ -97,7 +133,7 @@ module Quby
|
|
97
133
|
headers[subschema.key] = subschema.label
|
98
134
|
end
|
99
135
|
end
|
100
|
-
|
136
|
+
|
101
137
|
{
|
102
138
|
headers: headers,
|
103
139
|
tables: tables,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quby-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|