Skip to content

Instantly share code, notes, and snippets.

@skatkov
Created December 1, 2016 16:28
Show Gist options
  • Save skatkov/4538be4a08ddce3e79d341f29d1a7695 to your computer and use it in GitHub Desktop.
Save skatkov/4538be4a08ddce3e79d341f29d1a7695 to your computer and use it in GitHub Desktop.
class QuestionType
## This is a class to avoid database lookup for survey_question_types table
## replicate actual table :
# id => :name
DATA = {
3 => 'Rank order',
4 => 'Constant sum',
5 => 'Drop-down menu',
6 => 'Numeric Freeform Input',
7 => 'Comment Box',
8 => 'Matrix multi-point scales select one',
9 => 'Matrix table multi-select',
11 => 'Welcome',
12 => 'Qualified',
13 => 'Declined',
14 => 'Image chooser(Select Many)',
10 => 'Image chooser(Select One)',
1 => 'Multiple-choice(Select One)',
2 => 'Multiple-choice(Select Multiple)',
15 => 'Text Freeform Input',
17 => 'Directions',
18 => 'Essay',
19 => 'User form',
20 => 'Star rating',
21 => 'Call me question'
}.freeze
DATA_REV = Hash[DATA.to_a.reverse].freeze
def self.name(id)
DATA[id]
end
def self.id(name)
DATA_REV[name]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment