kjayma / surveyor_gui

An extension to nubic/surveyor that adds reports and a forms to build surveys
MIT License
45 stars 42 forks source link

Question groups support #7

Closed alepore closed 10 years ago

alepore commented 10 years ago

This is my main concern because most of my questions uses groups. Would like to discuss how this can be implemented, not sure how to start.

kjayma commented 10 years ago

Ok. Ill look at surveyor tonight and give it some thought. On May 21, 2014 11:45 AM, "Alessandro Lepore" notifications@github.com wrote:

This is my main concern because most of my questions uses group. Would like to discuss how this can be implemented, not sure how to start.

— Reply to this email directly or view it on GitHubhttps://github.com/kjayma/surveyor_gui/issues/7 .

kjayma commented 10 years ago

Not a simple exercise. Here are my thoughts ...

From a ui perspective:

From a processing perspective:

Not sure yet how to do this, but I think it will involve some methods in the Question model, and maybe a new class to handle moving around question groups.

That's all I've got for now.

alepore commented 10 years ago

thanks for your thoughts! in general i think the question group logic should be hidden to the user in some way for complex groups like grids. your idea may work for simple groups like "put all those questions under the same name (group)".

looking at SM types.. i'll need to replicate those 3 "matrix" types (for the third i tweaked surveyor so it's actually custom stuff). i'm a bit worried :worried:

alepore commented 10 years ago

their UI for grid is actually very basic this can be a way for my grids... "simply" get data from textareas and then do all the hard work to build the correct stuff

kjayma commented 10 years ago

Hmm, I like that. We could toss the add row buttons for building answers and do it the same way. Much simpler.

The approach you point to eliminates the issue of orphan question groups. So in this case, we build two new question_types in the Question model.

Alessandro, what kind of time constraints are you up against?

kjayma commented 10 years ago

I think this would be easier to do if we switch the question builder to an Exhibit Pattern. If you can hang loose for a few days, I could whip something up.

alepore commented 10 years ago

i'm pretty short with time, need to do most of the work this weekend and next week

kjayma commented 10 years ago

I did some work to be able to generate rows based on lines in a textbox. You can take a look at the answers_from_text branch.

kjayma commented 10 years ago

Almost have grids working. Take a look at show_groups_in_surveyform branch.

alepore commented 10 years ago

good! looking at it right now. noticed a problem: when i edit a grid question and close the box, also without changes, SurveyformsController#replace_question does something wrong, rows disappear and i get a list of the column values.

kjayma commented 10 years ago

Yeah, its not there yet. I'm going to get it green, but then I'm going to have to refactor some. Peeling back the onion, my original idea became a lot more complicated than I wanted.

alepore commented 10 years ago

bug report: create survey, add grid question, add another grid question: i get 10 grid questions and not 2

alepore commented 10 years ago

more in general, seems a good start to me! this is becoming good stuff. agree that this whole thing is inherently complex, refactor can be very important to avoid going crazy with the code. but i had not chance to take a deep look to the code yet.

kjayma commented 10 years ago

Reproduced thie issue - will address it.

kjayma commented 10 years ago

10 grid questions issue fixed and pushed.

alepore commented 10 years ago

thanks!!

kjayma commented 10 years ago

Think this one is just about put to bed. Repeaters still outstanding.

alepore commented 10 years ago

bug report: if i add an "other" answer at question creation i get a text field on all answers. instead, if i edit a question and add an "other" answer, i get the text box only on that one (correct). tried with "Multiple Choice (only one answer)"

alepore commented 10 years ago

i'm not sure about that "Are you:" question from my seed file. That's two different questions (pick one AND a text field) grouped under the same title. there's a simple way to support that? or maybe it's better to ask the client create two separate questions...

alepore commented 10 years ago

but i have also those grids with a free text area at the end... i think is basically the "comment" here https://github.com/NUBIC/surveyor/blob/master/doc/question%20types.png

maybe just adding an optional, simple free text "comment" may solve ?

alepore commented 10 years ago

about Repeaters i don't know nothing (probably because i don't need them :smile:)

kjayma commented 10 years ago

So there are two major items outstanding,

  1. Simple group - create a group of simple questions (picks allowed but not grids). They display inline or down the page. Will work on that today. I think that may be all you need to support your target survey.
  2. Repeaters - you may not need them, but they are a useful part of surveyor. If you look at the kitchen sink survey, there's a question for "What cars do you own?" and it asks about make, model, and year. What if a survey taker has 2 cars, or even 10? They need to be able to specify make, model, and year for as many cars as they own. Since the survey maker can't know how many cars there are, we give the survey taker an add question button. I think surveyor_gui should support this (but we can get your priorities knocked out first).

There's one more item that I'm not sure is worth supporting. This is the ability to add multiple possible answers to a single question, like the kitchen sink "Help me write an Improv sketch question". It has text fields for "who", "what", and "where". To me, this always seemed redundant with groups and potentially confusing.

I think you should take a look at your survey and rethink using logic. IMHO, its sometimes a better alternative to a group question. If your application may eventually go mobile, it would suck for the user to have to navigate a massive group question. Much simpler to ask them one question at a time and only show the other questions in the group if they apply.

alepore commented 10 years ago

not sure about the 1), i'll try to explain better: what i need is not a generic way of grouping different questions but "just" adding a comment field to some (both picks and grids). the comment is basically a single text question, i've read the word "comment" on that surveyor image.

for example what SM does is, when adding the "other" answer, asking if it has to be one of the answers or a separate one (comment). can work for me.

what do you think?

kjayma commented 10 years ago

So would the comment be a single field at the bottom? Like this:

            A              B              C

X Y Z Comment: __

?

alepore commented 10 years ago

yes, just a name (to be inserted) and a textarea. if i'm not wrong is like what surveyor creates as response_class: :string, display_type: "hidden_label"

kjayma commented 10 years ago

Need to play with surveyor a bit and see how it mixes grids with other questions into the same group. Would want to come up with a generic solution for this.

kjayma commented 10 years ago

fixed this bug:

bug report:
if i add an "other" answer at question creation i get a text field on all answers.
instead, if i edit a question and add an "other" answer, i get the text box only on that one (correct).
tried with "Multiple Choice (only one answer)"
kjayma commented 10 years ago

Comments working well for grid. Showing properly on surveyform for picks, however, will need slight customization to surveyor to suppress radio button - that's outstanding.

alepore commented 10 years ago

looks good! no problems so far. how do you suggest radio suppression? via JS or template?

kjayma commented 10 years ago

Template - need to query the newly added attribute; is_comment attribute == false ? show radio button : hide radio button

kjayma commented 10 years ago

grid dropdowns working. Missing a bunch ot tests and some stuff I need to get green again though.

kjayma commented 10 years ago

added a columns model to support grids (not rows) which will need to be supported in Surveyor with some custom code in the views.

alepore commented 10 years ago

grid dropdowns looks very good, closing this