Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Answers #44

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Answers #44

wants to merge 8 commits into from

Conversation

juliettech13
Copy link
Collaborator

Made it so that answers get saved every time and conditional statement so that content box for suggestions only appears if person clicks on the yes button

@juliettech13 juliettech13 requested review from CMA12 and ejohnst2 June 27, 2018 21:56
Copy link
Collaborator

@CMA12 CMA12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after fixing the conflics this branch looks fine to me

Copy link
Contributor

@ejohnst2 ejohnst2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the submit button and cracked the case on the one-click-answer submission for Answer.content, but what we still need is this conditional statement that you made - can you pull the latest master, throw that conditional on and push it back up? I just tested and re-tested the answer storage and its looking good.

<%= f.hidden_field :question_id, :value => clause.questions[1].id %>
<div class="buttonspacing">
<%= f.select(:content, options_for_select([['No', 'No'], ['Yes', 'Yes']])) %>
<a data-action="slideshow#next"><%= f.submit 'submit', :class => 'btn-primary' %></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, but then they would need to choose an option and then click a 'submit' button? That's what we originally had, but then it's a lot more fluid when they can just choose their option and move on. I was trying to decipher how to get the submit button to submit the content that's on it, rather than making it a two-step process. Unless I'm reading this form wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have figured it out, it was :name => "content", which signifies params[:content] - so need to do that for all of them, and also made an edit to the answers controller params[:content] .... and then to fix the not being shown twice, I had to fix where the second two answers were storing, it was a copy/paste fuck up on my end, basically the answers were being stored as the same question_id as the second one, so that's why the first and second question wouldn't show when a user already answered them but the third and fourth would. The unless loop was working, but the answer was storing as the wrong thing -_-. Its all working and storing correctly now with the values from the buttons as the :content.

@answer.content = params[:answer][:content]
@answer.user_id = current_user.id
@answer.question = Question.find(params[:answer][:question_id])
@answer = Answer.new(answer_params)

if current_user == nil
redirect_to new_user_registration_path
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants