quby-compiler 0.5.35 → 0.5.36

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: a21391f3c8b8e87e569154611f701918f002f296dd989f6a2a3fb532c6e97b57
4
- data.tar.gz: bb2269eee7a3c44155416d5b55fae9363b501180c24140f8b46dccca7f5259d0
3
+ metadata.gz: 45c8bbec37f2c99aaf33cbb7eb1fd0d7ab0e652c9173bf65cd9e84495f7adf23
4
+ data.tar.gz: 4a17cf5484dc9154e5c96b276a1c2f0cfa3358adb9ce0e1f0a37a51690493e18
5
5
  SHA512:
6
- metadata.gz: c0658acad6b54a986f2033d8807bf0d837a9c3725cdde0e5d41fbf9a8c208252a085bffa96229b6462bd76e0d1408f911d7d441ff039133716e534adbdc4eb9f
7
- data.tar.gz: 33bcd08d06a3afa16b2d9903b4c454f4c9a22e43da01212c6d2d601504446c5e2830fd521820eca2cb5a7c9502ba5bd0306599f87299de365bd1f1e032420008
6
+ metadata.gz: 68acd5fbc780bd6b31fdc43aa1d2a266ab69416c16ba2475fed0ecce8de526b443c0d69b07a45076de2ffedb633222b60cf3eb3f8f3312ccca6042129acad80c
7
+ data.tar.gz: 93b072eea61d9833505d08cd022ba9651a8f513bb006d881d04512d46211fdf2368ead687f2bf05bf85eb97c94b532b18e9ede1e9398a83c9f80e13f746050ad
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.5.36
2
+
3
+ * Fix visibility_rules ordering.
4
+ * seeds.yml: use option#label when available.
5
+
1
6
  # 0.5.35
2
7
 
3
8
  * 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
@@ -398,7 +398,7 @@ module Quby
398
398
  # 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
399
  def visibility_rules
400
400
  return @visibility_rules if @visibility_rules
401
- question_order = sorted_questions.map.with_index{ [_1, _2] }.to_h
401
+ question_order = sorted_questions.map.with_index{ [_1.key, _2] }.to_h
402
402
  @visibility_rules ||= [
403
403
  *flags.values.flat_map { |flag| VisibilityRule.from_flag(flag) },
404
404
  *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: :always, field_key: question.key },
13
- action: { type: :hide_question, field_key: question.key })
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: :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 })
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: :equal)
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: :contains)
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: :show_question, field_key: shows_question })
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: :hide_question, field_key: hides_question })
44
+ action: { type: 'hide_question', field_key: hides_question })
45
45
  end
46
46
  end
47
47
  end
@@ -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)
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.5.35"
3
+ VERSION = "0.5.36"
4
4
  end
5
5
  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.35
4
+ version: 0.5.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-09-23 00:00:00.000000000 Z
10
+ date: 2025-10-01 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