Skip to content

Commit

Permalink
create and edit qtype hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Feb 4, 2025
1 parent 980c642 commit c992e30
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions app/models/forms/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ class Export # rubocop:disable Metrics/ClassLength
].freeze

QTYPE_TO_XLS = {
# conversions
"location" => "geopoint",
"long_text" => "text",
# direct conversions
"datetime" => "dateTime",
"annotated_image" => "image",
"counter" => "integer",

# conversions with added "appearance" column
# https://xlsform.org/en/#appearance
"long_text" => "text", # "multiline"
"annotated_image" => "image", # "annotate"
"counter" => "integer", # "counter"
"sketch" => "image", # "draw"
"signature" => "image", # "signature"
"location" => "geopoint", # "placement-map"

# no change
"text" => "text",
Expand All @@ -30,17 +35,22 @@ class Export # rubocop:disable Metrics/ClassLength
"barcode" => "barcode",
"audio" => "audio",
"video" => "video",
"integer" => "integer",

# TODO: Not yet supported in our XLSForm exporter
"sketch" => "sketch (WARNING: not yet supported)",
"signature" => "signature (WARNING: not yet supported)"
"integer" => "integer"

# Note: XLSForm qtypes not supported in NEMO:
# range, geotrace, geoshape, note, file, select_one_from_file, select_multiple_from_file,
# background-audio, calculate, acknowledge, hidden, xml-external
}.freeze

QTYPE_TO_APPEARANCE = {
"long_text" => "multiline",
"annotated_image" => "annotate",
"counter" => "counter",
"sketch" => "draw",
"signature" => "signature",
"location" => "placement-map",
}.freeze

def initialize(form)
@form = form
end
Expand Down

0 comments on commit c992e30

Please sign in to comment.