View Issue Details

IDProjectCategoryView StatusLast Update
16760Development Otherpublic2020-10-21 19:04
ReporterJHoeck Assigned ToJHoeck  
PrioritynoneSeverityminor 
Status assignedResolutionopen 
Summary16760: Qanda Refactoring
Description

At the moment we are thinking about refactoring the qanda helper. We noticed following issues:

  • The qanda helper is used for rendering multiple question types.
  • Qanda helper is using many globals.
  • Qanda helper is using an array $thissurvey and $ia. $ia is created at createFieldMap(common_helper line 1227)
    // $ia ARRAY CONTENTS -
    // [0]=questions.qid,
    // [1]=fieldname,
    // [2]=questions.title,
    // [3]=questions.question
    // [4]=questions.type,
    // [5]=questions.gid,
    // [6]=questions.mandatory,
    // [7]=conditionsexist,
    // [8]=usedinconditions
    // [8]=usedinconditions
    // [9]=used in group.php for question count
    // [10]=new group id for question in randomization group (GroupbyGroup Mode)
TagsNo tags attached.

Relationships

related to 16772 new Bug reports Allow plugin to add question attributes 

Activities

DenisChenu

DenisChenu

2020-10-20 09:50

developer   ~60285

Some qanda_helper function was already replaced by core/QuestionType …

Then : in my opinion : no need to rewrite qanda_helper : just create all core questiontype …

https://github.com/LimeSurvey/LimeSurvey/blob/master/application/core/QuestionTypes/LoadQuestionTypes.php

Some coire question type just load current qanda function, some other have been rewritten

DenisChenu

DenisChenu

2020-10-20 09:51

developer   ~60286

PS : since it's not «really» a bug, can we move it to Devlopment section ?

ollehar

ollehar

2020-10-20 10:08

administrator   ~60287

Moved to dev.

ollehar

ollehar

2020-10-20 10:09

administrator   ~60288

We can move do_render() to question types, but later we should really create a proper module structure for each question.

DenisChenu

DenisChenu

2020-10-20 10:20

developer   ~60291

we should really create a proper module structure for each question.

The current one is not OK ?
https://github.com/LimeSurvey/LimeSurvey/commits/master/application/core/QuestionTypes

ollehar

ollehar

2020-10-20 10:25

administrator   ~60293

Last edited: 2020-10-20 10:26

View 4 revisions

It's not OK, no.

1) Missing config.
2) Missing EM integration
3) Missing viewfiles (twig)
4) Where is database structure for each type, when survey is activated?
5) createFieldmap should call each question module
6) Etc etc etc

Ask yourself this: Is it possible to add a new question type without touching old code? When yes, we have a good structure. :D Then we can also allow question types as a zip file upload, as with plugins.

DenisChenu

DenisChenu

2020-10-20 10:26

developer   ~60294

lol …

Then do a lot of thing for … nothing … ?

I ask to have REAL way to do something by external system since years now …

ollehar

ollehar

2020-10-20 10:28

administrator   ~60295

I started some work on this my first year (on my free time), but it got shut down. Eventually we'll have to return to it, together. https://manual.limesurvey.org/Question_object_types

Then do a lot of thing for … nothing … ?

Hopefully it's a step in the right direction. :)

ollehar

ollehar

2020-10-21 11:29

administrator   ~60330

Last edited: 2020-10-21 11:30

View 2 revisions

Mission 1:

Move do_<question> to renderer object.

Example: RenderArray10ChoiceQuestion calls do_array_10point from qanda, but qanda should be moved to this class instead. And the same for all question types.

If we want to make $ia more descriptive, we can create a wrapper class for it and getRendererObject($ia) in qanda can instead be getRendererObject(new IaWrapper($ia));

DenisChenu

DenisChenu

2020-10-21 12:42

developer   ~60331

Yes, some do_ are deprecated, i add the @deprecated when i see it
https://github.com/LimeSurvey/LimeSurvey/commit/b849e036a99c3013d34b019d65c902145cfb3e84

But : this issue is about moving do_… part to the Render… part or it's another things ?

ollehar

ollehar

2020-10-21 14:25

administrator   ~60333

But : this issue is about moving do_… part to the Render… part or it's another things ?

Mainly this, right now. Maybe we'll create subtasks later.

DenisChenu

DenisChenu

2020-10-21 14:42

developer   ~60334

OK :)

Great

(need DB definition better than current one)

Issue History

Date Modified Username Field Change
2020-10-20 09:32 JHoeck New Issue
2020-10-20 09:32 JHoeck Status new => assigned
2020-10-20 09:32 JHoeck Assigned To => JHoeck
2020-10-20 09:50 DenisChenu Note Added: 60285
2020-10-20 09:51 DenisChenu Note Added: 60286
2020-10-20 10:08 ollehar Project Bug reports => Development
2020-10-20 10:08 ollehar Note Added: 60287
2020-10-20 10:09 ollehar Note Added: 60288
2020-10-20 10:20 DenisChenu Note Added: 60291
2020-10-20 10:25 ollehar Note Added: 60293
2020-10-20 10:25 ollehar Note Edited: 60293 View Revisions
2020-10-20 10:26 ollehar Note Edited: 60293 View Revisions
2020-10-20 10:26 DenisChenu Note Added: 60294
2020-10-20 10:26 ollehar Note Edited: 60293 View Revisions
2020-10-20 10:28 ollehar Note Added: 60295
2020-10-21 11:29 ollehar Note Added: 60330
2020-10-21 11:30 ollehar Note Edited: 60330 View Revisions
2020-10-21 12:42 DenisChenu Note Added: 60331
2020-10-21 14:25 ollehar Note Added: 60333
2020-10-21 14:42 DenisChenu Note Added: 60334
2020-10-21 19:04 DenisChenu Relationship added related to 16772