Comments (14)
maybe we can have a config, where we can change delimiter. say from ,
to :
?
from rapidfire.
I think it's splitting an array based on commas and commas within the array elements are getting split.
Sent from my iPhone
On May 11, 2014, at 8:22 PM, Yuva [email protected] wrote:
maybe we can have a config, where we can change delimiter. say from , to : ?
โ
Reply to this email directly or view it on GitHub.
from rapidfire.
Hi, I'm having the same problem with comma. I think it comes from the flatten :
rapidfire / app / services / rapidfire / question_group_results.rb
answers = question.answers.map(&:answer_text).map { |text| text.split(',') }.flatten
I'm not sure there is a better way than changing the comma in something else (with a config or not). When changing this delimiter, could we use ยง
or |
as it has huge chance not to be in the answer_text ?
I have listed the functions I think that should be changed :
- save! in rapidfire / app / services / rapidfire / answer_group_builder.rb
- extract in rapidfire / app / services / rapidfire / question_group_results.rb
- checkbox_checked? in rapidfire / app / helpers / rapidfire / application_helper.rb
What do you think ?
from rapidfire.
+1 for config, but im not in favor of utf-8 chars.
@gnufied suggested to use \r\n\r\n
, which web uses.
from rapidfire.
+1 for config and \r\n\r\n
.
I used to split with \n
in perl, I should have think about it ;p good idea @gnufied.
from rapidfire.
I think this will give the results without having to worry about commas or special characters.
answers = question.answers.group(:answer_text).count(:answer_text)
from rapidfire.
work is under progress in this branch: provide-delimiter-config-for-answers
. please feel free to test that branch. i have to write a rake task to convert the existing questions and answers to use new delimiter (if required)
from rapidfire.
@alexnesbitt there is a slight catch with
answers = question.answers.group(:answer_text).count(:answer_text)
in case of checkboxes, we store all the answers in answer_text
with a delimiter. so, count
wont help in that case.
from rapidfire.
Why do you treat checkboxes that way? Why not just store each answer that gets checked as it's own answer? That way, count will work fine.
from rapidfire.
@alexnesbitt we have a usecase where user can see his/her answers against a questionnaire, and modify them. it becomes easy to populate the form again, if we have only answer, rather than a bunch of answers. i haven't faced any difficulties so far, so i guess we are good.
from rapidfire.
I don't understand why having multiple answers is an issue for rendering a
user's answer group. It should be pretty simple to get the questions, get
the question's answers, iterate and set the matched values to true.
But it's not an issue for me so no need to change things for me.
On Mon, May 19, 2014 at 8:35 PM, Yuva [email protected] wrote:
@alexnesbitt https://github.com/alexnesbitt we have a usecase where
user can see his/her answers against a questionnaire, and modify them. it
becomes easy to populate the form again, if we have only answer, rather
than a bunch of answers. i haven't faced any difficulties so far, so i
guess we are good.โ
Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-43583332
.
Alex Nesbitt
Digital Podcast
562-824-5193
Connect with me on:
Digital Podcast http://www.digitalpodcast.com/company
LinkedIn: http://www.linkedin.com/in/alexnesbitt
Facebook: http://www.facebook.com/alexnesbitt
Twitter: http://twitter.com/alexnesbitt
from rapidfire.
i think i should have explained it better: rendering multiple answers associated with a single question (checkbox) was an issue:
- we have to iterate over all the existing answers, and it didn't seem very straightforward.
- updating answers seemed difficult, say user is updating questionnaire, and changed answers to a checkbox. now backend should delete individual answers which are unchecked. it was becoming bit of work.
@alexnesbitt thanks for bringing this up. i will keep this solution at the back of mind, and implement it if i get into trouble in future :)
from rapidfire.
I understand the problem of trying to sync the answer when something that is becomes something that isn't. Very tough.
In this case, I would delete all the answers in the answer group in case of an update and create new answers for whatever the user submits in their edit form.
Thanks for what you have built. It was the best I could find for my use case.
My bigger problem is scalability. Neither the method you use or the count method is going to work with Very high volume. I'm thinking I need to combine your approach to building the questionnaire with something like redis to keep the totals ready for a responsive view with 1000s if answer groups
Sent from my iPhone
On May 19, 2014, at 9:43 PM, Yuva [email protected] wrote:
i think i should have explained it better: rendering multiple answers associated with a single question (checkbox) was an issue:
we have to iterate over all the existing answers, and it didn't seem very straightforward.
updating answers seemed difficult, say user is updating questionnaire, and changed answers to a checkbox. now backend should delete individual answers which are unchecked. it was becoming bit of work.
@alexnesbitt thanks for bringing this up. i will keep this solution at the back of mind, and implement it if i get into trouble in future :)โ
Reply to this email directly or view it on GitHub.
from rapidfire.
nice :)
im looking forward to those scalability issues. maybe i can learn a thing or two, if you can share your experience, as in how you have solved those problems.
from rapidfire.
Related Issues (20)
- Rails 5.1: Directly inheriting from ActiveRecord::Migration is not supported HOT 1
- Rails 5.1: Index Creation fails HOT 3
- undefined local variable or method `rapidfire' for #<Rapidfire::QuestionsController:0x0....> HOT 1
- When using checkboxes, validation always fails HOT 6
- undefined method `before_filter' for Rapidfire::SurveysController:Class Did you mean? before_action HOT 2
- ActionController::UrlGenerationError in Rapidfire::Surveys#index HOT 1
- Bundler could not find compatible versions for gem "active_model_serializers" HOT 2
- One attempt for each user
- Links for Rapidfire redirect with bad link HOT 1
- Change `after_survey_content` to `thank_you` HOT 1
- Rename locales to include rapidfire prefix HOT 1
- answers_delimiter = "\r\n" HOT 3
- undefined method `page' for Survey:Module HOT 1
- Non logged in users not able to submit responses
- Path issues HOT 4
- Acts_as_surveyable? HOT 2
- API support HOT 4
- after attempt redirect HOT 1
- Question text as a label HOT 1
- Feature Request: Images as part of the question HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rapidfire.