Skip to content

Commit

Permalink
Include Response#response_group in the response JSON. NUBIC#349.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Yip committed Jul 23, 2012
1 parent 5e4665d commit d372e65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/views/surveyor/show.json.rabl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ child (@response_set.responses || []) => :responses do
attribute :api_id => :uuid
attribute :created_at
attribute :updated_at => :modified_at
attribute :response_group
node(:answer_id){|r| r.answer.api_id }
node(:question_id){|r| r.question.api_id }
node(:value, :if => lambda{|r| r.answer.response_class != "answer"}){|r| r.as(r.answer.response_class) }
Expand Down
6 changes: 6 additions & 0 deletions doc/response_set_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
"question_id": {
"$ref": "http://download.nubic.northwestern.edu/surveyor/api_id_schema.json#"
},
"response_group": {
"type": [
"string",
"null"
]
},
"updated_at": {
"$ref": "http://download.nubic.northwestern.edu/surveyor/surveyor_timestamp_schema.json#"
},
Expand Down
4 changes: 4 additions & 0 deletions features/export_to_json.feature
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ Feature: Survey export
"uuid":"*",
"answer_id":"*",
"question_id":"*",
"response_group":null,
"created_at":"*",
"modified_at":"*"
},{
"uuid":"*",
"answer_id":"*",
"question_id":"*",
"response_group":null,
"created_at":"*",
"modified_at":"*",
"value":"orange"
Expand Down Expand Up @@ -225,6 +227,7 @@ Feature: Survey export
"uuid":"*",
"answer_id":"*",
"question_id":"*",
"response_group":null,
"created_at":"*",
"modified_at":"*",
"value":"orange"
Expand All @@ -242,6 +245,7 @@ Feature: Survey export
"uuid":"*",
"answer_id":"*",
"question_id":"*",
"response_group":null,
"created_at":"*",
"modified_at":"*",
"value":"blueish"
Expand Down

0 comments on commit d372e65

Please sign in to comment.