quby-compiler 0.5.36 → 0.5.38
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/questionnaire_builder.rb +1 -1
- data/lib/quby/compiler/entities/question.rb +5 -0
- data/lib/quby/compiler/entities/question_option.rb +2 -0
- data/lib/quby/compiler/entities/questionnaire.rb +4 -2
- 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/definition_validator.rb +24 -0
- data/lib/quby/compiler/version.rb +1 -1
- metadata +2 -3
- data/lib/quby/compiler/dsl/merge(values(:v_1, :v_2), values(v_4).rb +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f717b87f1eeac5b54e6230cc80880a40b46596790536a513a3802d050e25ab6
|
|
4
|
+
data.tar.gz: e28bf580f65ab625b51d8448f5a49f03169694a0864e7d3d888cef7d7d83f3f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ee40da6cd79071369b6b183ef357b915a03a6f7755a92e06ee61167c7a39863086656b61e715e03e68db0d856d4fbf76b394801ae488c5673750aa7ac57cd2e
|
|
7
|
+
data.tar.gz: be3c0096361e0713738fdbbd3e2d497c9788a0dfe72df83298e189caa811ca55707d57f78bc32c7acb6ae42c7f4e9b3f646865e675b86a2c60a458d865c41528
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# 0.5.38
|
|
2
|
+
|
|
3
|
+
* Fail when using unsupported features in layout_version :v2
|
|
4
|
+
* Allow context_description to set via question options, so custom_methods don't have to specifically mention it.
|
|
5
|
+
|
|
6
|
+
# 0.5.37
|
|
7
|
+
|
|
8
|
+
* added support for indenting questions
|
|
9
|
+
* quby2: Added versionNumber.
|
|
10
|
+
* added validations for checkbox options to have a (context_free_)description
|
|
11
|
+
* removed bulkview logic
|
|
12
|
+
|
|
1
13
|
# 0.5.36
|
|
2
14
|
|
|
3
15
|
* Fix visibility_rules ordering.
|
|
@@ -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
|
|
@@ -149,6 +152,7 @@ module Quby
|
|
|
149
152
|
@context_free_title = options[:context_free_title]
|
|
150
153
|
@allow_blank_titles = options[:allow_blank_titles]
|
|
151
154
|
@description = options[:description]
|
|
155
|
+
@context_description = options[:context_description]
|
|
152
156
|
@display_modes = options[:display_modes]
|
|
153
157
|
@presentation = options[:presentation]
|
|
154
158
|
@validations = []
|
|
@@ -169,6 +173,7 @@ module Quby
|
|
|
169
173
|
@default_invisible = options[:default_invisible] || false
|
|
170
174
|
@labels ||= []
|
|
171
175
|
@css_vars = options[:css_vars]
|
|
176
|
+
@indent = options[:indent]
|
|
172
177
|
|
|
173
178
|
@col_span = options[:col_span] || 1
|
|
174
179
|
@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
|
|
@@ -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,
|
|
@@ -30,6 +30,7 @@ module Quby
|
|
|
30
30
|
validate_info_blocks(questionnaire)
|
|
31
31
|
validate_checkbox_options(questionnaire)
|
|
32
32
|
validate_visiblity_rules(questionnaire)
|
|
33
|
+
validate_quby2_unsupported_features(questionnaire)
|
|
33
34
|
# Some compilation errors are Exceptions (pure syntax errors) and some StandardErrors (NameErrors)
|
|
34
35
|
rescue Exception => exception # rubocop:disable Lint/RescueException
|
|
35
36
|
definition.errors.add(:sourcecode, message: "Questionnaire error: #{definition.key}\n" \
|
|
@@ -436,6 +437,29 @@ scores_schema tables to the resulting seed."
|
|
|
436
437
|
end
|
|
437
438
|
end
|
|
438
439
|
end
|
|
440
|
+
|
|
441
|
+
def validate_quby2_unsupported_features(questionnaire)
|
|
442
|
+
return unless questionnaire.layout_version == :v2
|
|
443
|
+
|
|
444
|
+
if questionnaire.extra_css.present?
|
|
445
|
+
fail "'extra_css' unsupported for Quby 2 layout."
|
|
446
|
+
end
|
|
447
|
+
questionnaire.questions.each do |question|
|
|
448
|
+
if question.title_question
|
|
449
|
+
fail "Question #{question.key} uses unsupported feature 'title_question' for Quby 2 layout."
|
|
450
|
+
end
|
|
451
|
+
if question.display_modes.present?
|
|
452
|
+
fail "Question #{question.key} uses unsupported feature 'display_modes' for Quby 2 layout."
|
|
453
|
+
end
|
|
454
|
+
end
|
|
455
|
+
questionnaire.panels.each do |panel|
|
|
456
|
+
panel.items.each do |item|
|
|
457
|
+
if item.is_a?(Entities::Table)
|
|
458
|
+
fail "Questionnaire uses unsupported feature 'table' for Quby 2 layout."
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
end
|
|
462
|
+
end
|
|
439
463
|
end
|
|
440
464
|
end
|
|
441
465
|
end
|
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.38
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marten Veldthuis
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-10-
|
|
10
|
+
date: 2025-10-27 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activemodel
|
|
@@ -151,7 +151,6 @@ 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
|
|
155
154
|
- lib/quby/compiler/dsl/panel_builder.rb
|
|
156
155
|
- lib/quby/compiler/dsl/question_builder.rb
|
|
157
156
|
- lib/quby/compiler/dsl/questionnaire_builder.rb
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|