View Issue Details

IDProjectCategoryView StatusLast Update
12402Feature requests[All Projects] Survey designpublic2017-07-19 13:41
Reporteruser14106Assigned To 
PrioritynoneSeverityfeature 
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary12402: Use JQuery QueryBuilder for defining Quotas
DescriptionThe limitations of using quota-s has been a problem for LS for year for my experience.
- "or" logic not supported
- a number of quetion types not supported

I have raised my voice on this also before. Eg- here
https://bugs.limesurvey.org/view.php?id=7598

I had a thought of using the EM logic also for quota, but after looking into it, I realized that EM is more for horizontal processing (inside one response) and is not suited for veritical -> building queries to DB.

I would suggest testing to use the JQuery QueryBuilder for composing the Quota logic
http://querybuilder.js.org/demo.html

It enables the usage of much more complex logic while keeping the query secure.
I have used the Yii2 querybuilder package from https://github.com/leandrogehlen/yii2-querybuilder
for yii1 probably could use something like https://github.com/mistic100/jQuery-QueryBuilder

I have a bit of experience of using it with yii2 and I could take on testing this if this seem like realistic way to go in the future

comments & thumbs in both directions are welcome to see if it is worth testing or not
TagsNo tags attached.

Relationships

related to 07598 new Ability to set quotas based on numerical input 

Activities

DenisChenu

DenisChenu

2017-07-18 15:14

developer   ~44100

I think we can just add Équation question type in Quota Gui edit : then we can make any quota (and we don't break existing quota).

Currently : the php code for public quota part is ready for Équation.

About SQL builder : i like it in "browse"/"export"/"Statistics" but not for quota :)

user14106

2017-07-18 15:35

  ~44101

Equation question type in Quota seems like a good idea. I'll have a bit of look into that too.

I'm currently working on creating a widget for yii1. If its usable then it might be for for various purposes. Even if not for LS :)
https://github.com/TonisOrmisson/yii1-querybuilder
based a bit on similar yii2 version
https://github.com/leandrogehlen/yii2-querybuilder
jelo

jelo

2017-07-18 16:38

reporter   ~44102

Why should the builder not be used for quota? Beside bundling issues?
Since EM is similar to a blackbox which nobody likes to touch it sounds like a good idea to stay away from EM till a refactoring of EM is done.

If LimeSurvey GmbH still wants to conquer the survey SaaS market, the quota system is competing against something like this. https://help.surveygizmo.com/help/logic-vs-distributed-quotas

The way LS GmbH is promoting the current quota functionality towards potential market research customers is a bit confusing, When first reading it I thought there was a new quota system already is place.
DenisChenu

DenisChenu

2017-07-18 16:58

developer   ~44103

About EM : for dev yes : it's complicated, but for user : it's really great and seems a lot used.

Like write on another bug report : currently if you kinow how to hack database to add an Equation question type : you have the system wuth Équation.

With a new complete system to make SQL :
1. How SQL security is managed ? Maybe there are a lot of security issue (didn't know).
2. How manage updating survey ? For example : SQL use question 22, we remove question 22 : we must search on a SQL string if question 22 is used. With current situation : really more easy
3. Adding a GUI on admin part : we can broke GUI but we don't broke public part.

I think this 3 point are really important to think of "Can we use another solution than a complete new solution". And if you want to talk about Saas VS concurrent : i don't care personnaly.

user14106

2017-07-18 17:28

  ~44104

I have nothing against EM - :)

If we have a simpler way of making quotas more flexible (eg Equation) I would support that initially,
Regarding the QueryBuilder. The idea is that the criterias are stored in DB not as SQL but as JSON structred as QueryBuilder outputs. Security is the idea why I have been using querybuilder instead of plain text criterias. Since data is stored as structured JSON its really easy to process that and manage security. There is a Translator to translate the JSON to SQL and all security can be managed there: eg:
https://github.com/leandrogehlen/yii2-querybuilder/blob/master/Translator.php
DenisChenu

DenisChenu

2017-07-18 17:32

developer   ~44105

Last edited: 2017-07-18 17:34

View 2 revisions

PS : have an hacked version of jquerybuilder to construct relevance (and replace current condition part) can be a great idea ;) too

PS2 : https://github.com/leandrogehlen/yii2-querybuilder/blob/master/Translator.php great ! Must test your extension in https://framagit.org/SondagePro-LimeSurvey-plugin/exportFilter ;)

user14106

2017-07-19 11:45

  ~44108

here's a first demo for the yii1-querybuilder widget
https://demo.andmemasin.eu/yii1-querybuilder/
DenisChenu

DenisChenu

2017-07-19 13:41

developer   ~44110

NEED IT for browse export. Replace current statistics filter ?

Issue History

Date Modified Username Field Change
2017-05-16 20:17 user14106 New Issue
2017-05-16 20:17 user14106 Summary Use JQuery QueryBuilder for definign Quotas => Use JQuery QueryBuilder for defining Quotas
2017-05-16 20:23 user14106 Relationship added related to 07598
2017-07-18 15:14 DenisChenu Note Added: 44100
2017-07-18 15:35 user14106 Note Added: 44101
2017-07-18 16:38 jelo Note Added: 44102
2017-07-18 16:58 DenisChenu Note Added: 44103
2017-07-18 17:28 user14106 Note Added: 44104
2017-07-18 17:32 DenisChenu Note Added: 44105
2017-07-18 17:34 DenisChenu Note Edited: 44105 View Revisions
2017-07-19 11:45 user14106 Note Added: 44108
2017-07-19 13:41 DenisChenu Note Added: 44110