[LRUG] Questionnaire engine
Andrew Premdas
apremdas at gmail.com
Thu Jul 23 02:01:25 PDT 2020
For wizards on Rails I personally prefer a full controller, views, and
model for each stage in the wizard. I came to this conclusion after using
wicked amongst other things. At first this seems counter-intuitive,
overkill, and far to complex but it has several benefits.
- you have full control
- conditional validation is super easy, and very clear
- conditional routing depending on step results is fairly straightforward
- you progress is recorded each time you submit a step
- you don't have to do anything in js
As far as the models go, you just create your basic rails model. Then for
each stage in the wizard you subclass the model (I store these in
form_models). So you get something like
class Tax::AdditionalIncome < Tax
validates: xxx
validates: yyy
...
end
The same applies to controllers and views, everything is just the same as
bog standard rails form. This approach is initially a lot slower, creating
each step takes more time, but you more than make up for that when you have
to tweak steps, change orders etc. etc.
All best
Andrew
On Wed, 22 Jul 2020 at 10:37, Ed James <ed.james.spam at gmail.com> wrote:
> Hi all
>
> Does anyone have any experience with building out a complex questionnaire
> engine?
> I’m very interested in hearing what people have done and whether you wrote
> from scratch or used any 3rd-party tools/gems/etc.
>
> Some of the things I need to be able to handle are:
>
>
> - Complex routing through the questionnaire based on answers to
> previous question(s)
> - Scoring/weighting of answers to calculate a final score
> - Grouping of weighted questions to allow for score calculations of
> “question groups”
> - Ability to “resume” questionnaire
> - Ability to “go back” through previous questions to change answers
> before completion
>
>
> Any advice/insights would be greatly appreciated.
>
> Thanks!
>
> ------------------------------
>
> Ed James
> I will respect your spam <ed.james.spam at gmail.com>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
--
------------------------
Andrew Premdas
blog.andrew.premdas.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20200723/842eaf3f/attachment.html>
More information about the Chat
mailing list