Giter VIP home page Giter VIP logo

Comments (14)

iffyuva avatar iffyuva commented on July 30, 2024

maybe we can have a config, where we can change delimiter. say from , to : ?

from rapidfire.

alexnesbitt avatar alexnesbitt commented on July 30, 2024

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.

alain-andre avatar alain-andre commented on July 30, 2024

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.

iffyuva avatar iffyuva commented on July 30, 2024

+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.

alain-andre avatar alain-andre commented on July 30, 2024

+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.

alexnesbitt avatar alexnesbitt commented on July 30, 2024

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.

iffyuva avatar iffyuva commented on July 30, 2024

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.

iffyuva avatar iffyuva commented on July 30, 2024

@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.

alexnesbitt avatar alexnesbitt commented on July 30, 2024

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.

iffyuva avatar iffyuva commented on July 30, 2024

@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.

alexnesbitt avatar alexnesbitt commented on July 30, 2024

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.

iffyuva avatar iffyuva commented on July 30, 2024

i think i should have explained it better: rendering multiple answers associated with a single question (checkbox) was an issue:

  1. we have to iterate over all the existing answers, and it didn't seem very straightforward.
  2. 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.

alexnesbitt avatar alexnesbitt commented on July 30, 2024

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.

iffyuva avatar iffyuva commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.