Sha256: c8d602898a11839e50cb04b83657d1993871674ef8b7715ec9e1c88401109804
Contents?: true
Size: 785 Bytes
Versions: 6
Compression:
Stored size: 785 Bytes
Contents
module SurveyorGui module Helpers module SurveyorGuiHelperMethods # Responses def response_for(response_set, question, answer = nil, response_group = nil, column_id = nil) return nil unless response_set && question && question.id result = response_set.responses.detect{|r| (r.question_id == question.id) && (answer.blank? ? true : r.answer_id == answer.id) && (r.response_group.blank? ? true : r.response_group.to_i == response_group.to_i) && (r.column_id.blank? ? true : r.column_id == column_id.to_i)} result.blank? ? response_set.responses.build( question_id: question.id, response_group: response_group, column_id: column_id) : result end end end end
Version data entries
6 entries across 6 versions & 2 rubygems