Skip to content

Instantly share code, notes, and snippets.

@knowuh
Last active December 26, 2015 06:29
Show Gist options
  • Save knowuh/7107926 to your computer and use it in GitHub Desktop.
Save knowuh/7107926 to your computer and use it in GitHub Desktop.
Error when trying to update learner data
json = data.to_json
=> "[{\"type\":\"open_response\",\"question_id\":\"624\",\"answer\":\"there is no exact statement that there will not be a leak in the line pumping water out of the ground or other accidental spilling of oil therefore the water could become contaminated\"},{\"type\":\"open_response\",\"question_id\":\"625\",\"answer\":\"there are always a percentage of accidents or problems that come with drilling for oil therefore we must take these into account before we attempt to drill so there are no problems in the community they are drilling in\"},{\"type\":\"open_response\",\"question_id\":\"626\",\"answer\":\"there is no waste there is no distribution of water to places it was not before there is no pollution and there is no way to spread toxic waste if there was an accident \"},{\"type\":\"open_response\",\"question_id\":\"627\",\"answer\":\"with all energy sources there are chances of problems however solar power is unlimited and there is no way to run out of the resource used to create it and there is no way to mess up the ecosystem around it.\"},{\"type\":\"open_response\",\"question_id\":\"628\",\"answer\":\"more people are out during the day so the wind direction during the day would effect the city more than it would at night.\"},{\"type\":\"open_response\",\"question_id\":\"629\",\"answer\":\"there is no good place to put a power plant there are always going to be problems with pollution because it spreads it wont just go away\"},{\"type\":\"open_response\",\"question_id\":\"630\",\"answer\":\"there will be less pollutants released in the city however the amount of pollutants released into the atmosphere will remain the same\"},{\"type\":\"open_response\",\"question_id\":\"631\",\"answer\":\"based on the graph the pollutants released will remain the same however the smog in the area will reduce because of the place in which the pollution is released\"},{\"type\":\"open_response\",\"question_id\":\"632\",\"answer\":\"the crops will catch the excess fertilizer and slow the amount of water going into the lake.\"},{\"type\":\"open_response\",\"question_id\":\"633\",\"answer\":\"if the feild redirects the water the fertilizer should slow its descend down the hill \"},{\"type\":\"open_response\",\"question_id\":\"634\",\"answer\":\"alfalfa replenishes the nutrients in the field therefor it would be more proactive for the farmer to use it\"},{\"type\":\"open_response\",\"question_id\":\"635\",\"answer\":\"Alfalfa replenishes the soil more than the other crops so it should help the farmer to plant it.\"},{\"type\":\"multiple_choice\",\"question_id\":\"424\",\"answer_ids\":[\"1567\"],\"answer_texts\":[\"yes\"]},{\"type\":\"multiple_choice\",\"question_id\":\"425\",\"answer_ids\":[\"1573\"],\"answer_texts\":[\"(5) Very certain\"]},{\"type\":\"multiple_choice\",\"question_id\":\"426\",\"answer_ids\":[\"1577\"],\"answer_texts\":[\"solar panels\"]},{\"type\":\"multiple_choice\",\"question_id\":\"427\",\"answer_ids\":[\"1582\"],\"answer_texts\":[\"(5) Very certain\"]},{\"type\":\"multiple_choice\",\"question_id\":\"428\",\"answer_ids\":[\"1583\"],\"answer_texts\":[\"Location A (near the ocean)\"]},{\"type\":\"multiple_choice\",\"question_id\":\"429\",\"answer_ids\":[\"1588\"],\"answer_texts\":[\"(3)\"]},{\"type\":\"multiple_choice\",\"question_id\":\"430\",\"answer_ids\":[\"1591\"],\"answer_texts\":[\"yes\"]},{\"type\":\"multiple_choice\",\"question_id\":\"431\",\"answer_ids\":[\"1597\"],\"answer_texts\":[\"(5) Very certain\"]},{\"type\":\"multiple_choice\",\"question_id\":\"432\",\"answer_ids\":[\"1599\"],\"answer_texts\":[\"Arrangement B: rows perpendicular to the hill\"]},{\"type\":\"multiple_choice\",\"question_id\":\"433\",\"answer_ids\":[\"1604\"],\"answer_texts\":[\"(4)\"]},{\"type\":\"multiple_choice\",\"question_id\":\"434\",\"answer_ids\":[\"1607\"],\"answer_texts\":[\"alfalfa\"]},{\"type\":\"multiple_choice\",\"question_id\":\"435\",\"answer_ids\":[\"1614\"],\"answer_texts\":[\"(4)\"]}]"
job = Dataservice::ProcessExternalActivityDataJob.new(learner_id, json)
job.perform()
Embeddable::MultipleChoiceChoice Load (0.6ms) SELECT `embeddable_multiple_choice_choices`.* FROM `embeddable_multiple_choice_choices` WHERE `embeddable_multiple_choice_choices`.`id` = 13662 LIMIT 1
Saveable::MultipleChoiceAnswer Load (0.6ms) SELECT `saveable_multiple_choice_answers`.* FROM `saveable_multiple_choice_answers` WHERE `saveable_multiple_choice_answers`.`multiple_choice_id` = 228732 ORDER BY position DESC LIMIT 1
Saveable::MultipleChoiceRationaleChoice Load (0.6ms) SELECT `saveable_multiple_choice_rationale_choices`.* FROM `saveable_multiple_choice_rationale_choices` WHERE `saveable_multiple_choice_rationale_choices`.`answer_id` = 236400 ORDER BY choice_id
Saveable::MultipleChoiceAnswer Load (0.6ms) SELECT `saveable_multiple_choice_answers`.* FROM `saveable_multiple_choice_answers` WHERE `saveable_multiple_choice_answers`.`multiple_choice_id` = 228732 ORDER BY position DESC LIMIT 1
Saveable::MultipleChoiceRationaleChoice Load (0.6ms) SELECT `saveable_multiple_choice_rationale_choices`.* FROM `saveable_multiple_choice_rationale_choices` WHERE `saveable_multiple_choice_rationale_choices`.`answer_id` = 236400 ORDER BY choice_id
NoMethodError: undefined method `choices' for #<Embeddable::OpenResponse:0x0000000662f3d0>
from /web/portal/shared/bundle/ruby/1.9.1/gems/activemodel-3.2.11/lib/active_model/attribute_methods.rb:407:in `method_missing'
from /web/portal/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/attribute_methods.rb:149:in `method_missing'
from /web/portal/releases/20131021163901/app/models/dataservice/process_external_activity_data_job.rb:36:in `block in internal_process_multiple_choice'
from /web/portal/releases/20131021163901/app/models/dataservice/process_external_activity_data_job.rb:36:in `map'
from /web/portal/releases/20131021163901/app/models/dataservice/process_external_activity_data_job.rb:36:in `internal_process_multiple_choice'
from /web/portal/releases/20131021163901/app/models/dataservice/process_external_activity_data_job.rb:22:in `block in perform'
from /web/portal/releases/20131021163901/app/models/dataservice/process_external_activity_data_job.rb:16:in `each'
from /web/portal/releases/20131021163901/app/models/dataservice/process_external_activity_data_job.rb:16:in `perform'
from (irb):10
from /web/portal/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /web/portal/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /web/portal/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment