[LRUG] Questionnaire engine
Tekin Süleyman
tekin at tekin.co.uk
Wed Jul 22 07:17:40 PDT 2020
The way we did conditional validations in the DfE project was to use validation contexts that mapped the current page/slug to specific validations, for example:
validates :current_school,
on: [:"current-school", :submit],
presence: {message: "Select a school from the list"}
Works for the most part but does result in a large/messy set of validations on the models.
Tekin
http://tekin.co.uk <http://tekin.co.uk/> / @tekin <https://twitter.com/tekin>
> On 22 Jul 2020, at 11:45, Ed Jones <ed at error.agency> wrote:
>
> We've used Wicked a few times, and wrote a gem to allow you to do conditional validation based on the step you're on: https://github.com/errorstudio/wicked-wizard-validations/ <https://github.com/errorstudio/wicked-wizard-validations/>
>
> I would echo Tekin - it's not the right solution for this. It's hard to reason with after a while, and that gem kinda demonstrates the complexity of relatively simple stuff.
>
> Ed
> --
> Error
> A human-centred interaction agency
>
> 4th Floor, 86-90 Paul Street,
> London, EC2A 4NE
>
> Tel: 020 3637 5060
> Mobile: 0779 187 4282
> Twitter: @erroragency
> http://error.agency <http://error.agency/>
>
>> On 22 Jul 2020, at 11:41, Tekin Süleyman <tekin at tekin.co.uk <mailto:tekin at tekin.co.uk>> wrote:
>>
>> Hi Ed,
>>
>> I recently completed a project for Department for Education that did a good chunk of those things from scratch:
>>
>> - Complex routing through the questionnaire
>> - "Go back" to previous questions/change answers
>>
>> Adding “resume” and scoring wouldn’t be too difficult but wasn’t needed for this particular project.
>>
>> It's open source and available to view on GitHub: https://github.com/DFE-Digital/claim-additional-payments-for-teaching <https://github.com/DFE-Digital/claim-additional-payments-for-teaching>.
>>
>> The best place to start to get an idea of how it works is to look at the ClaimsController, the central Claim model and the two journey-specific SlugSequence classes that combine with the PageSequence class to provide the routing logic/flow.
>>
>> It was written to support two separate question sets/flows that have a shared set of common questions (the Claim) and flow-specific questions (see the polymorphic Eligibility models and corresponding namespaces), with the idea that more could be added in the future without too much difficulty.
>>
>> I know of the wicked <https://github.com/zombocom/wicked> gem that I’ve seen used for step-by-step wizard-style flows. I’ve not used it personally but I would be very wary of building an engine of any sort of complexity on top of something like this. In my experience they work great until you need to do something slightly outside of what it supports, then you’re buggered.
>>
>>
>> Tekin
>> http://tekin.co.uk <http://tekin.co.uk/> / @tekin <https://twitter.com/tekin>
>>
>>
>>> On 22 Jul 2020, at 10:37, Ed James <ed.james.spam at gmail.com <mailto: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 <mailto:ed.james.spam at gmail.com>
>>> _______________________________________________
>>> Chat mailing list
>>> Chat at lists.lrug.org <mailto:Chat at lists.lrug.org>
>>> Archives: http://lists.lrug.org/pipermail/chat-lrug.org <http://lists.lrug.org/pipermail/chat-lrug.org>
>>> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org <http://lists.lrug.org/options.cgi/chat-lrug.org>
>>> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org <http://lists.lrug.org/listinfo.cgi/chat-lrug.org>
>>
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org <mailto: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
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20200722/ef493d3f/attachment.html>
More information about the Chat
mailing list