Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch for download/export blank answers #1241

Merged
merged 1 commit into from
Mar 2, 2018

Conversation

briri
Copy link
Contributor

@briri briri commented Mar 1, 2018

@@ -40,7 +40,7 @@
<% end %>

<% answer = @plan.answer(question[:id], false) %>
<% blank = answer.present? ? answer.text.gsub(/<\/?p>/, '').gsub(/<br\s?\/?>/, '').chomp.blank? : true %>
<% blank = (answer.present? && !answer.text.blank?) ? answer.text.gsub(/<\/?p>/, '').gsub(/<br\s?\/?>/, '').chomp.blank? : true %>
Copy link
Contributor

Choose a reason for hiding this comment

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

@briri, please consider is_valid? instead (e.g. https://github.com/DMPRoadmap/roadmap/blob/development/app/models/answer.rb#L75) since answers for an option_based question the text is purely a comment.

Copy link
Contributor

@jollopre jollopre left a comment

Choose a reason for hiding this comment

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

@briri, please check my comment and if it makes sense, change it and merge afterwards

@briri
Copy link
Contributor Author

briri commented Mar 2, 2018

switched to use answer.is_valid? instead of checking for blank. I think it would be good to move the additional checks found in views/shared/export/_plan.erb into that method afterword to make sure the answer.text doesn't contain things like <p></p> which would currently evaluate to a valid response. Too close to your release though to make that change as it would potentially impact the plan writing pages

@briri briri merged commit 9ab7ce1 into DMPRoadmap:development Mar 2, 2018
@briri briri deleted the issue1240 branch April 9, 2018 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants