quby-compiler 0.5.9 → 0.5.11

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: 392bac29f2cc7b4b00ce1344f010b39941148e96e5e529d6487f8e0d49a5a5fe
4
- data.tar.gz: 7c0538c6243f30481c3f282bfc2892874494454b64f5eb0013b0a0a4aa56e0c8
3
+ metadata.gz: b8077f55592000120cadb53b6bf02081d2f1bb98bacdfd7a35133efc91d64fff
4
+ data.tar.gz: 05c78c8b6c61f5317d087145ede42828d62df898be40f8fd8c9e584d6625f865
5
5
  SHA512:
6
- metadata.gz: 8360a9fd3ec70b80766ece8d51bbbc301067ae7eb8c441515c06dc8c8003205527290c10b1249948deb5b4fab798a1e61ba56e03594f1e5188f5a43d3fbffa9f
7
- data.tar.gz: 16b077a6db915f93dd30f6c6bb8f411c5c21e8cd2adc3ba279abbc11596a34598bd3e80dbea4527b431e7f1719f5eecb78c39f1c1252011c7d71a2332b576331
6
+ metadata.gz: 51256d96238a758e40e9dac04cad8e011038ccb98b0a97c27b134e05505f2fa28145b6a4296ae778e661483460feff6c2d6ab7208f06fc5b975236a08d60c080
7
+ data.tar.gz: 5f7b82f1f302c1677a0e50764ec58576be05ba4d06218710e85190f4ffab8a3433cc13e3a79af17a4a80edb2cb0b9c7c8a5ef0e99440a2c74d38e820d6fe64c3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 0.5.11
2
+
3
+ * dsl
4
+ * Add layout_version
5
+ * quby2.json
6
+ * Add layout_version
7
+ * roqua.json
8
+ * Add renderer based on layout_version
9
+
10
+ # 0.5.10
11
+
12
+ * Removed only_for_export flag. No longer used and did not do what people expected it to do.
13
+
1
14
  # 0.5.9
2
15
 
3
16
  * added `require 'ostruct'` since running quby-compile suddenly fails on this.
@@ -131,8 +131,8 @@ module Quby
131
131
  @questionnaire.enable_previous_questionnaire_button = true
132
132
  end
133
133
 
134
- def renderer_version(version)
135
- @questionnaire.renderer_version = version
134
+ def layout_version(version)
135
+ @questionnaire.layout_version = version
136
136
  end
137
137
 
138
138
  def css(value)
@@ -4,7 +4,7 @@ module Quby
4
4
  module Compiler
5
5
  module Entities
6
6
  class Flag < Struct.new(:key, :description_true, :description_false, :description, :internal, :trigger_on,
7
- :shows_questions, :hides_questions, :depends_on, :default_in_interface)
7
+ :shows_questions, :hides_questions, :depends_on, :default)
8
8
  # rubocop:disable ParameterLists
9
9
  def initialize(key:,
10
10
  description_true: nil,
@@ -15,10 +15,11 @@ module Quby
15
15
  shows_questions: [],
16
16
  hides_questions: [],
17
17
  depends_on: [], # used in interface to hide this flag unless the depended on flag is set to true
18
+ default: nil,
18
19
  default_in_interface: nil) # used in interface to set a default for the flag state,
19
20
  # does not have an effect outside of the interface
20
21
  super(key, description_true, description_false, description, internal, trigger_on, shows_questions,
21
- hides_questions, Array.wrap(depends_on).map(&:to_s), default_in_interface)
22
+ hides_questions, Array.wrap(depends_on).map(&:to_s), (default.nil? ? default_in_interface : default))
22
23
  end
23
24
  # rubocop:enable ParameterLists
24
25
 
@@ -37,7 +37,7 @@ module Quby
37
37
  @charts = Charting::Charts.new
38
38
  @fields = Fields.new(self)
39
39
  @license = :unknown
40
- @renderer_version = :v1
40
+ @layout_version = nil
41
41
  @extra_css = ""
42
42
  @allow_switch_to_bulk = false
43
43
  @panels = []
@@ -71,7 +71,7 @@ module Quby
71
71
  attr_accessor :panels
72
72
  attr_accessor :score_calculations
73
73
  attr_accessor :default_answer_value
74
- attr_accessor :renderer_version
74
+ attr_accessor :layout_version
75
75
  attr_writer :leave_page_alert
76
76
  attr_reader :fields
77
77
  attr_accessor :extra_css
@@ -10,8 +10,6 @@ module Quby
10
10
  # The shortened key that will used as the field/column name for csv and oru exports,
11
11
  # excluding the questionnaire key part
12
12
  attribute :export_key, Types::Symbol
13
- # [Optional] Whether this score will only be exported through oru/api/data exports, but not shown in interfaces
14
- attribute :only_for_export?, Types::Bool
15
13
  # [Optional] The key of the variable definition used to calculate the subscore result.
16
14
  attribute :calculation_key?, Types::Symbol
17
15
  # [Optional argument] The name of the outcome table where this subscore should be shown. Used for cases where scores
@@ -225,7 +225,6 @@ module Quby
225
225
  key: subschema.key,
226
226
  label: subschema.label,
227
227
  export_key: subschema.export_key,
228
- only_for_export: subschema.only_for_export
229
228
  }
230
229
  end
231
230
  }
@@ -283,7 +282,7 @@ module Quby
283
282
  shows_questions: flag.shows_questions,
284
283
  hides_questions: flag.hides_questions,
285
284
  depends_on: flag.depends_on,
286
- default_in_interface: flag.default_in_interface,
285
+ default: flag.default,
287
286
  }
288
287
  end
289
288
  end
@@ -332,7 +331,6 @@ module Quby
332
331
  license: questionnaire.license,
333
332
  licensor: questionnaire.licensor,
334
333
  language: questionnaire.language,
335
- renderer_version: questionnaire.renderer_version,
336
334
  last_author: questionnaire.last_author,
337
335
  extra_css: questionnaire.extra_css,
338
336
  allow_switch_to_bulk: questionnaire.allow_switch_to_bulk,
@@ -13,6 +13,7 @@ module Quby
13
13
  def as_json(options = {})
14
14
  {
15
15
  key: key,
16
+ layout_version: layout_version || :v1,
16
17
  title: title,
17
18
  language: language || "nl",
18
19
  description: description,
@@ -23,6 +23,7 @@ module Quby
23
23
  def as_json(options = {})
24
24
  {
25
25
  key: questionnaire.key,
26
+ renderer:,
26
27
  versions: versions,
27
28
  keys: questionnaire.roqua_keys,
28
29
  roqua_keys: questionnaire.roqua_keys,
@@ -45,6 +46,14 @@ module Quby
45
46
  }
46
47
  end
47
48
 
49
+ def renderer
50
+ case questionnaire.layout_version
51
+ when :v2 then 'quby2'
52
+ when :v1 then 'quby'
53
+ else nil
54
+ end
55
+ end
56
+
48
57
  def versions
49
58
  questionnaire.versions.map do |version|
50
59
  {
@@ -261,7 +270,6 @@ module Quby
261
270
  key: subscore.key,
262
271
  label: subscore.label,
263
272
  export_key: subscore.export_key,
264
- only_for_export: subscore.only_for_export.presence,
265
273
  type: subscore.type
266
274
  }.compact
267
275
  }
@@ -279,7 +287,8 @@ module Quby
279
287
  shows_questions: flag.shows_questions,
280
288
  hides_questions: flag.hides_questions,
281
289
  depends_on: flag.depends_on,
282
- default_in_interface: flag.default_in_interface
290
+ default: flag.default,
291
+ default_in_interface: flag.default # TODO: Remove this when Roqua supports default natively
283
292
  }
284
293
  end
285
294
  end
@@ -45,6 +45,10 @@ module Quby
45
45
  if questionnaire.description && questionnaire.description.size > 255
46
46
  fail "Questionnaire description is too long."
47
47
  end
48
+
49
+ unless [nil, :v1, :v2].include?(questionnaire.layout_version)
50
+ fail "Questionnaire layout_version must be either :v1 or :v2."
51
+ end
48
52
  end
49
53
 
50
54
  def validate_fields(questionnaire)
@@ -315,15 +315,10 @@ module Quby
315
315
  questionnaire.score_schemas.values.each do |score_schema|
316
316
  score_labels << score_schema.label
317
317
  score_keys << score_schema.subscore_schemas.map do |subschema|
318
- hash = {
318
+ {
319
319
  key: subschema.key,
320
320
  header: subschema.export_key.to_s # a shortened key used as PART OF the csv export column headers
321
321
  }
322
- if subschema.only_for_export
323
- hash.merge(hidden: true)
324
- else
325
- hash
326
- end
327
322
  end
328
323
 
329
324
  headers = score_schema.subscore_schemas.map(&:label)
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.5.9"
3
+ VERSION = "0.5.11"
4
4
  end
5
5
  end
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.5.9
4
+ version: 0.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-05 00:00:00.000000000 Z
11
+ date: 2025-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel