quby-compiler 0.5.35 → 0.5.37
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/quby/compiler/dsl/merge(values(:v_1, :v_2), values(v_4).rb +16 -0
- data/lib/quby/compiler/dsl/questionnaire_builder.rb +1 -1
- data/lib/quby/compiler/entities/question.rb +4 -0
- data/lib/quby/compiler/entities/question_option.rb +2 -0
- data/lib/quby/compiler/entities/questionnaire.rb +5 -3
- data/lib/quby/compiler/entities/visibility_rule.rb +10 -10
- data/lib/quby/compiler/outputs/quby_frontend_v1_serializer.rb +0 -1
- data/lib/quby/compiler/outputs/quby_frontend_v2_serializer.rb +3 -0
- data/lib/quby/compiler/services/quby_proxy.rb +3 -3
- data/lib/quby/compiler/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f99d7e4e00d6ab08172da731229ed790720f8131ca55a9919a8d6f4823da1bbe
|
|
4
|
+
data.tar.gz: a7855f35d16daded7a21e60564322576b7ea8f967052e72d8d4f8eb194b53f04
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c0260b251395ef6fcf757ecc1ddaf120139716c6f0ae27a77450dea9719d76f103891b060b74146aee408d68febffd398436ce613d3c8031215e6f6b01035d6
|
|
7
|
+
data.tar.gz: e20c44b3fba04514aa601e52c9b7321e185bbea66d9e12e112efdd20023b91bfc52f30de3f4ebf0959426eb4aa351499abe2b7b4b5e5ac5ea2b6b04b5e4f5544
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# 0.5.37
|
|
2
|
+
|
|
3
|
+
* added support for indenting questions
|
|
4
|
+
* quby2: Added versionNumber.
|
|
5
|
+
* added validations for checkbox options to have a (context_free_)description
|
|
6
|
+
* removed bulkview logic
|
|
7
|
+
|
|
8
|
+
# 0.5.36
|
|
9
|
+
|
|
10
|
+
* Fix visibility_rules ordering.
|
|
11
|
+
* seeds.yml: use option#label when available.
|
|
12
|
+
|
|
1
13
|
# 0.5.35
|
|
2
14
|
|
|
3
15
|
* Fix sexp validations not always recursing right.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
merge(values(:v_1, :v_2), values(v_4).recode(1 => 3)).sum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
divide(value(:v_2), multiply(value(:v_1), value(:v_1)))
|
|
6
|
+
|
|
7
|
+
w / l * l
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
sexp_variable :key1 do
|
|
11
|
+
foo = values(:v_1, :v_2)
|
|
12
|
+
bar = recode(foo, 1 => 3)
|
|
13
|
+
bla = merge(foo, bar)
|
|
14
|
+
sum(bla)
|
|
15
|
+
|
|
16
|
+
end
|
|
@@ -30,6 +30,9 @@ module Quby
|
|
|
30
30
|
|
|
31
31
|
# extra styling options
|
|
32
32
|
attr_accessor :css_vars
|
|
33
|
+
# indent the question, to make it belong to the previous one.
|
|
34
|
+
attr_accessor :indent
|
|
35
|
+
validates :indent, inclusion: {in: [nil, 0, 1], message: "must be 0 or 1"}
|
|
33
36
|
|
|
34
37
|
# To hide old questions
|
|
35
38
|
attr_accessor :hidden
|
|
@@ -169,6 +172,7 @@ module Quby
|
|
|
169
172
|
@default_invisible = options[:default_invisible] || false
|
|
170
173
|
@labels ||= []
|
|
171
174
|
@css_vars = options[:css_vars]
|
|
175
|
+
@indent = options[:indent]
|
|
172
176
|
|
|
173
177
|
@col_span = options[:col_span] || 1
|
|
174
178
|
@row_span = options[:row_span] || 1
|
|
@@ -14,6 +14,8 @@ module Quby
|
|
|
14
14
|
validates :value, numericality: {allow_nil: true} # nil for checkbox questions.
|
|
15
15
|
attr_reader :label
|
|
16
16
|
attr_reader :description, :context_free_description
|
|
17
|
+
validates :context_free_description, presence: {if: -> { question.type == :check_box && label.blank? && description.blank? && !inner_title }, message: "(context_free_)description must be present"}
|
|
18
|
+
|
|
17
19
|
attr_reader :questions
|
|
18
20
|
# for scale/radio/checbox questions, piece of of html that is rendered between the options
|
|
19
21
|
attr_reader :inner_title
|
|
@@ -41,7 +41,6 @@ module Quby
|
|
|
41
41
|
@layout_version = nil
|
|
42
42
|
@extra_css = ""
|
|
43
43
|
@css_vars = nil
|
|
44
|
-
@allow_switch_to_bulk = false
|
|
45
44
|
@panels = []
|
|
46
45
|
@flags = {}.with_indifferent_access
|
|
47
46
|
@textvars = {}.with_indifferent_access
|
|
@@ -82,7 +81,6 @@ module Quby
|
|
|
82
81
|
attr_reader :fields
|
|
83
82
|
attr_accessor :extra_css
|
|
84
83
|
attr_accessor :css_vars
|
|
85
|
-
attr_accessor :allow_switch_to_bulk
|
|
86
84
|
attr_reader :license
|
|
87
85
|
attr_accessor :licensor
|
|
88
86
|
attr_accessor :language
|
|
@@ -136,6 +134,10 @@ module Quby
|
|
|
136
134
|
@roqua_keys || [key]
|
|
137
135
|
end
|
|
138
136
|
|
|
137
|
+
def version_number
|
|
138
|
+
versions.last&.number || 0
|
|
139
|
+
end
|
|
140
|
+
|
|
139
141
|
def to_param
|
|
140
142
|
key
|
|
141
143
|
end
|
|
@@ -398,7 +400,7 @@ module Quby
|
|
|
398
400
|
# This is important since a shown question can't be hidden, so each question is only ever changed once while looping over the rules.
|
|
399
401
|
def visibility_rules
|
|
400
402
|
return @visibility_rules if @visibility_rules
|
|
401
|
-
question_order = sorted_questions.map.with_index{ [_1, _2] }.to_h
|
|
403
|
+
question_order = sorted_questions.map.with_index{ [_1.key, _2] }.to_h
|
|
402
404
|
@visibility_rules ||= [
|
|
403
405
|
*flags.values.flat_map { |flag| VisibilityRule.from_flag(flag) },
|
|
404
406
|
*sorted_questions.flat_map { |question| VisibilityRule.from(question) },
|
|
@@ -9,24 +9,24 @@ module Quby
|
|
|
9
9
|
# Transform "default invisible" into just being hidden by itself,
|
|
10
10
|
# since any other question showing it will take precedence anyway.
|
|
11
11
|
if question.default_invisible
|
|
12
|
-
rules << new(condition: { type:
|
|
13
|
-
action: { type:
|
|
12
|
+
rules << new(condition: { type: 'always', field_key: question.key },
|
|
13
|
+
action: { type: 'hide_question', field_key: question.key })
|
|
14
14
|
end
|
|
15
15
|
if question.hidden # hide by default, show if data is already present.
|
|
16
|
-
rules << new(condition: { type:
|
|
17
|
-
action: { type:
|
|
18
|
-
rules << new(condition: { type:
|
|
19
|
-
action: { type:
|
|
16
|
+
rules << new(condition: { type: 'always', field_key: question.key },
|
|
17
|
+
action: { type: 'hide_question', field_key: question.key })
|
|
18
|
+
rules << new(condition: { type: 'answered', evenWhenHidden: true, field_key: question.key },
|
|
19
|
+
action: { type: 'show_question', field_key: question.key })
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
case question.type
|
|
23
23
|
when :radio, :scale, :select
|
|
24
24
|
question.all_options.each do |option|
|
|
25
|
-
rules.concat rules_for_option(question, option, type:
|
|
25
|
+
rules.concat rules_for_option(question, option, type: 'equal')
|
|
26
26
|
end
|
|
27
27
|
when :check_box
|
|
28
28
|
question.options.each do |option|
|
|
29
|
-
rules.concat rules_for_option(question, option, type:
|
|
29
|
+
rules.concat rules_for_option(question, option, type: 'contains')
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -36,12 +36,12 @@ module Quby
|
|
|
36
36
|
[].tap do |rules|
|
|
37
37
|
option.shows_questions.each do |shows_question|
|
|
38
38
|
rules << new(condition: { type: type, field_key: question.key, value: option.key },
|
|
39
|
-
action: { type:
|
|
39
|
+
action: { type: 'show_question', field_key: shows_question })
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
option.hides_questions.each do |hides_question|
|
|
43
43
|
rules << new(condition: { type: type, field_key: question.key, value: option.key },
|
|
44
|
-
action: { type:
|
|
44
|
+
action: { type: 'hide_question', field_key: hides_question })
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -335,7 +335,6 @@ module Quby
|
|
|
335
335
|
language: questionnaire.language,
|
|
336
336
|
last_author: questionnaire.last_author,
|
|
337
337
|
extra_css: questionnaire.extra_css,
|
|
338
|
-
allow_switch_to_bulk: questionnaire.allow_switch_to_bulk,
|
|
339
338
|
|
|
340
339
|
panels: panels,
|
|
341
340
|
score_calculations: score_calculations,
|
|
@@ -27,6 +27,7 @@ module Quby
|
|
|
27
27
|
visibilityRules: visibility_rules.as_json,
|
|
28
28
|
sexpVariables: sexp_variables,
|
|
29
29
|
cssVars: css_vars,
|
|
30
|
+
versionNumber: version_number,
|
|
30
31
|
}.compact.tap do |json|
|
|
31
32
|
validate_all_questions_in_a_panel_question_keys(json)
|
|
32
33
|
end
|
|
@@ -202,6 +203,8 @@ module Quby
|
|
|
202
203
|
contextDescription: handle_html(question.context_description, type: :prose, v1_markdown: false),
|
|
203
204
|
type: question_type(question),
|
|
204
205
|
cssVars: question.css_vars,
|
|
206
|
+
indent: question.indent,
|
|
207
|
+
|
|
205
208
|
hidden: question.hidden?,
|
|
206
209
|
displayModes: question.display_modes,
|
|
207
210
|
viewSelector: question.view_selector,
|
|
@@ -40,7 +40,7 @@ module Quby
|
|
|
40
40
|
when :select
|
|
41
41
|
d_qtypes[question.key.to_s] = { type: :discrete }
|
|
42
42
|
for option in question.all_options
|
|
43
|
-
d_qtypes[question.key.to_s][option.value.to_s] = strip_p_tag(option.context_free_description || option.description || "") unless option.placeholder
|
|
43
|
+
d_qtypes[question.key.to_s][option.value.to_s] = strip_p_tag(option.context_free_description || option.label || option.description || "") unless option.placeholder
|
|
44
44
|
end
|
|
45
45
|
update_hidden_questions_for(question)
|
|
46
46
|
when :check_box
|
|
@@ -53,7 +53,7 @@ module Quby
|
|
|
53
53
|
end
|
|
54
54
|
value = 1
|
|
55
55
|
option_type = { type: :discrete }
|
|
56
|
-
option_type[value.to_s] = (option.context_free_description || option.description || "")
|
|
56
|
+
option_type[value.to_s] = (option.context_free_description || option.label || option.description || "")
|
|
57
57
|
option_type[:depends] = { values: [value, value.to_s].uniq, variable: option.key.to_s } unless options[:without_depends]
|
|
58
58
|
d_qtypes[option.key.to_s] = option_type
|
|
59
59
|
values = [value, value.to_s].uniq
|
|
@@ -278,7 +278,7 @@ module Quby
|
|
|
278
278
|
update_hidden_questions_for(question)
|
|
279
279
|
for option in question.all_options
|
|
280
280
|
next if option.inner_title
|
|
281
|
-
d_qtypes[question.key.to_s][option.value.to_s] = strip_p_tag(option.context_free_description || option.description || "")
|
|
281
|
+
d_qtypes[question.key.to_s][option.value.to_s] = strip_p_tag(option.context_free_description || option.label || option.description || "")
|
|
282
282
|
values << option.value.to_s
|
|
283
283
|
key = question.key.to_s
|
|
284
284
|
handle_subquestions(question, quests, d_qtypes, vars, option, [option.value.to_s], key)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: quby-compiler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.37
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marten Veldthuis
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-
|
|
10
|
+
date: 2025-10-16 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activemodel
|
|
@@ -151,6 +151,7 @@ files:
|
|
|
151
151
|
- lib/quby/compiler/dsl/charting/radar_chart_builder.rb
|
|
152
152
|
- lib/quby/compiler/dsl/helpers.rb
|
|
153
153
|
- lib/quby/compiler/dsl/info_block_builder.rb
|
|
154
|
+
- lib/quby/compiler/dsl/merge(values(:v_1, :v_2), values(v_4).rb
|
|
154
155
|
- lib/quby/compiler/dsl/panel_builder.rb
|
|
155
156
|
- lib/quby/compiler/dsl/question_builder.rb
|
|
156
157
|
- lib/quby/compiler/dsl/questionnaire_builder.rb
|