Created
June 16, 2011 17:19
-
-
Save mattrw89/1029727 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@people.each do |person| | |
@questions.each do |q| | |
@answer_sheets[person] = person.answer_sheets.select {|as| q.question_sheets.collect(&:id).include?(as.question_sheet_id)}.flatten.uniq | |
logger.info @answer_sheets[person].collect {|x| q.display_response(x)}.inspect | |
logger.info @answer_sheets[person].inspect | |
#logger.info q.display_response(@answer_sheets[person]).inspect | |
end | |
end | |
LOG: | |
[#<AnswerSheet id: 4, question_sheet_id: 7, created_at: "2011-06-04 01:15:56", completed_at: nil, person_id: 1282204>, #<AnswerSheet id: 6, question_sheet_id: 8, created_at: "2011-06-06 18:11:35", completed_at: nil, person_id: 1282204>] | |
Person Load (0.3ms) SELECT `ministry_person`.* FROM `ministry_person` WHERE `ministry_person`.`personID` = 1282204 LIMIT 1 | |
CACHE (0.0ms) SELECT `ministry_person`.* FROM `ministry_person` WHERE `ministry_person`.`personID` = 1282204 LIMIT 1 | |
["Matt", "Matt"] | |
QuestionSheet Load (0.3ms) SELECT `mh_question_sheets`.* FROM `mh_question_sheets` INNER JOIN `mh_pages` ON `mh_question_sheets`.`id` = `mh_pages`.`question_sheet_id` INNER JOIN `mh_page_elements` ON `mh_pages`.`id` = `mh_page_elements`.`page_id` WHERE `mh_page_elements`.`element_id` = 4 | |
[#<AnswerSheet id: 4, question_sheet_id: 7, created_at: "2011-06-04 01:15:56", completed_at: nil, person_id: 1282204>, #<AnswerSheet id: 6, question_sheet_id: 8, created_at: "2011-06-06 18:11:35", completed_at: nil, person_id: 1282204>] | |
["User", "User"] | |
QuestionSheet Load (0.2ms) SELECT `mh_question_sheets`.* FROM `mh_question_sheets` INNER JOIN `mh_pages` ON `mh_question_sheets`.`id` = `mh_pages`.`question_sheet_id` INNER JOIN `mh_page_elements` ON `mh_pages`.`id` = `mh_page_elements`.`page_id` WHERE `mh_page_elements`.`element_id` = 5 | |
[#<AnswerSheet id: 4, question_sheet_id: 7, created_at: "2011-06-04 01:15:56", completed_at: nil, person_id: 1282204>, #<AnswerSheet id: 6, question_sheet_id: 8, created_at: "2011-06-06 18:11:35", completed_at: nil, person_id: 1282204>] | |
EmailAddress Load (0.2ms) SELECT `email_addresses`.* FROM `email_addresses` WHERE `email_addresses`.`person_id` = 1282204 AND `email_addresses`.`primary` = 1 LIMIT 1 | |
CACHE (0.0ms) SELECT `email_addresses`.* FROM `email_addresses` WHERE `email_addresses`.`person_id` = 1282204 AND `email_addresses`.`primary` = 1 LIMIT 1 | |
["[email protected]", "[email protected]"] | |
QuestionSheet Load (0.3ms) SELECT `mh_question_sheets`.* FROM `mh_question_sheets` INNER JOIN `mh_pages` ON `mh_question_sheets`.`id` = `mh_pages`.`question_sheet_id` INNER JOIN `mh_page_elements` ON `mh_pages`.`id` = `mh_page_elements`.`page_id` WHERE `mh_page_elements`.`element_id` = 6 | |
[#<AnswerSheet id: 4, question_sheet_id: 7, created_at: "2011-06-04 01:15:56", completed_at: nil, person_id: 1282204>] | |
["Fourth Year"] | |
QuestionSheet Load (0.3ms) SELECT `mh_question_sheets`.* FROM `mh_question_sheets` INNER JOIN `mh_pages` ON `mh_question_sheets`.`id` = `mh_pages`.`question_sheet_id` INNER JOIN `mh_page_elements` ON `mh_pages`.`id` = `mh_page_elements`.`page_id` WHERE `mh_page_elements`.`element_id` = 7 | |
[#<AnswerSheet id: 4, question_sheet_id: 7, created_at: "2011-06-04 01:15:56", completed_at: nil, person_id: 1282204>] | |
Answer Load (0.2ms) SELECT `mh_answers`.* FROM `mh_answers` WHERE `mh_answers`.`answer_sheet_id` = 4 | |
["Yours"] | |
QuestionSheet Load (0.3ms) SELECT `mh_question_sheets`.* FROM `mh_question_sheets` INNER JOIN `mh_pages` ON `mh_question_sheets`.`id` = `mh_pages`.`question_sheet_id` INNER JOIN `mh_page_elements` ON `mh_pages`.`id` = `mh_page_elements`.`page_id` WHERE `mh_page_elements`.`element_id` = 8 | |
[#<AnswerSheet id: 6, question_sheet_id: 8, created_at: "2011-06-06 18:11:35", completed_at: nil, person_id: 1282204>] | |
Answer Load (0.2ms) SELECT `mh_answers`.* FROM `mh_answers` WHERE `mh_answers`.`answer_sheet_id` = 6 | |
["Yes"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment