View Issue Details

This bug affects 1 person(s).
 12
IDProjectCategoryView StatusLast Update
18459Bug reportsOtherpublic2024-05-02 14:37
ReporterMazi Assigned Totibor.pacalat  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version3.28.x 
Summary18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed
Description

At the survey list surveys assigned to a child survey group are not listed when selecting the parent survey group as a filter, see screenshot.

Steps To Reproduce

Steps to reproduce

Create a parent survey group P.
Create a child survey group C of which P is the parent.
Assign a survey to survey group C.
Filter the survey list by parent survey group P.

Expected result

The survey assigned to child survey group C should show up.

Actual result

Survey is not listed when applying that filter.

TagsNo tags attached.
Attached Files
image.png (23,980 bytes)   
image.png (23,980 bytes)   
image-2.png (18,512 bytes)   
image-2.png (18,512 bytes)   
Bug heat12
Complete LimeSurvey version number (& build)3.28.32
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMariaDB 10.1.48
Server OS (if known)
Webserver software & version (if known)
PHP VersionPHP 7.4

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2023-04-11 12:21

updater   ~74457

@ollehar, can we assign this to a developer please?

gabrieljenik

gabrieljenik

2023-04-21 20:15

manager   ~74591

This is tricky.

The filter is "Group" and the expectation (from the bug case) is to be able to filter by any ancestor.
Am I right?

If so, I must tell it is a tricky thing as it could involve some recursion.
@ollehar, thoughts?

Thanks

Mazi

Mazi

2023-05-11 15:40

updater   ~74933

Yes, when filtering for the parent group, I expect surveys of child groups to not get ignored but listed as well since they belong to the parent group.

gabrieljenik

gabrieljenik

2023-05-11 16:38

manager   ~74934

Sorry, as to clarify: the case is you want to filter surveys not by its parent group but by an ancesotr, right?

Ex:
Survey Group: Nova
--- Survey Group: Nova Melbourne
--- --- Survey : Research Melbourne
--- Survey Group: Nova Sydney
--- --- Survey : Research Sydney

You want to filter surveys by Nova and see surveys "Research Sydney" and "Research Melbourne".
Right?

Mazi

Mazi

2023-05-11 16:51

updater   ~74935

Correct!

gabrieljenik

gabrieljenik

2023-05-11 16:56

manager   ~74936

It is a tricky thing as it could involve some recursion.

Something I have in mind for making things not DB intensive:

  • Pickup selected ancestor.
  • Do a full query dump of the survey groups table
  • Look for all childs, recursively. (I would say on average we would have 5 levels max?)
  • Filter surveys by using an in comparison.

From a technical point of view, not very fan of this type of filters.
But I understand could be usefull.
Not sure it is worth the effort now.

@ollehar, thoughts?

Mazi

Mazi

2023-05-11 18:06

updater   ~74937

@gabrieljenik: Sound good. And a nesting level of 5 should definitely be sufficient.

Would love to see this implemented because if confused more than 1 customer that surveys of child groups have not been shown when filtering.

ollehar

ollehar

2023-05-12 10:00

administrator   ~74942

What about free text search "Nova"? Does it include survey group name too?

ollehar

ollehar

2023-05-12 10:01

administrator   ~74943

One possible easy fix is to join with the first parent-child relation as a default, and ignore deeper levels.

gabrieljenik

gabrieljenik

2023-05-12 13:57

manager   ~74952

Just choose the poison, I will implement it :)

The join thing could be a workaround, although probably will always be a customer for which will fall short.

Another option could be to solve it through a new plugin event and a plugin?
Then would be easier to activate it and deactivate when customers need it?

ollehar

ollehar

2023-05-12 14:02

administrator   ~74953

Last edited: 2023-05-12 14:02

If we're fine with having a limit, a child-parent relation can be fetched x levels down with x number of SQL JOINs.

Maybe you can check what that would look like in code, Gabriel? To just fetched the first level.

Mazi

Mazi

2023-05-12 14:50

updater   ~74954

No additional plugin please. Many customers have at least one sub-group so that affects a lot of people. If I'd have to activate a plugin first to make a basic search feature work, that's not user friendly.

ollehar

ollehar

2023-05-12 14:52

administrator   ~74955

Last edited: 2023-05-12 14:52

Alright, so many two levels to start with?

DenisChenu

DenisChenu

2023-05-12 16:28

developer   ~74956

Yes, when filtering for the parent group, I expect surveys of child groups to not get ignored but listed as well since they belong to the parent group.

+1 at 100% out of plugin too (exceptional for me)

Maybe we can cache the childs, empty the cache when a group is saved, created or deleted
I write cache, not static real caching.

gabrieljenik

gabrieljenik

2023-05-17 22:08

manager   ~75049

Last edited: 2023-05-17 22:09

PR for v3: https://github.com/LimeSurvey/LimeSurvey/pull/3147
If good, will port to v5 and master

DenisChenu

DenisChenu

2023-05-19 10:15

developer   ~75098

@Mazi : maybe you can test on 3.X ?

Mazi

Mazi

2023-05-21 20:18

updater   ~75126

@gabrieljenik, I replaced the survey.php file with the one from your commit at my v3.28.xx version. The survey group search worked as expected.

But when I searched the survey list for "test" I got this error (see screenshot for relation to survey.php):
query parameter: index.php/admin/survey/sa/listsurveys?Survey%5Bsearched_value%5D=test&active=&gsid=&yt0=Search

CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'surveygroup.title' in 'where clause'. The SQL statement executed was: SELECT COUNT(DISTINCT t.sid) FROM lime_surveys t LEFT OUTER JOIN lime_surveys_languagesettings correct_relation_defaultlanguage ON (correct_relation_defaultlanguage.surveyls_language=t.language) AND (correct_relation_defaultlanguage.surveyls_survey_id=t.sid) LEFT OUTER JOIN lime_users owner ON (t.owner_id=owner.uid) WHERE (((((t.sid LIKE :ycp0) OR (t.admin LIKE :ycp1)) OR (owner.users_name LIKE :ycp2)) OR (correct_relation_defaultlanguage.surveyls_title LIKE :ycp3)) OR (surveygroup.title LIKE :ycp4))

/var/www/vhosts/my-survey.host/httpdocs/ls3dev.my-survey.host/ls/framework/db/CDbCommand.php(543)

DenisChenu

DenisChenu

2023-05-22 08:52

developer   ~75127

Issue confirmed

Another issue with id=2 if group 2 have subgroups

How to reproduce

Create SurveyGroup aaa
Create Surveygroup aaaChild child of aaa
Put a surey in aaaChild
Select in dropdoxn : OK
Click on sureyGrousp
Click on aa group : NOT ok

See screencast.

Maybe time to remove this awful line … https://github.com/LimeSurvey/LimeSurvey/blob/0c9c5c8efe51b5af785c34b059c75ce206d906ad/application/models/Survey.php#LL1646C18-L1646C18
and set gid in controller

Peek 22-05-2023 08-51.gif (286,161 bytes)
gabrieljenik

gabrieljenik

2023-05-22 14:31

manager   ~75134

Another issue with id=2 if group 2 have subgroups

Your expectation is to have 2 surveys being shown at the end of your test?
Something like "when clicking on a survey group name on the survey group list, I should see all surveys that are child, grand child, ... fo that survey group" ?

DenisChenu

DenisChenu

2023-05-22 14:50

developer   ~75136

Your expectation is to have 2 surveys being shown at the end of your test?

Yes, i think it's the expectation ping @Mazi ?

gabrieljenik

gabrieljenik

2023-05-23 22:59

manager   ~75202

when clicking on a survey group name on the survey group list, I should see all surveys that are child, grand child, ... fo that survey group

Done

gabrieljenik

gabrieljenik

2023-05-24 21:39

manager   ~75220

Master PR: https://github.com/LimeSurvey/LimeSurvey/pull/3167
5.x PR: https://github.com/LimeSurvey/LimeSurvey/pull/3168

DenisChenu

DenisChenu

2023-05-25 08:33

developer   ~75221

3+5+6 reviewed

ollehar

ollehar

2023-05-25 10:57

administrator   ~75222

Did you test it too Denis, or just read the code?

ollehar

ollehar

2023-05-25 10:57

administrator   ~75223

Else maybe Mazi can test. :)

DenisChenu

DenisChenu

2023-05-25 11:55

developer   ~75224

Did you test it too Denis, or just read the code?

I test the 3.X version, but not 5 and 6 since it's near same code.

gabrieljenik

gabrieljenik

2023-05-25 13:58

manager   ~75227

We can test... but next week. (non labour today and tomorrow) :)

guest

guest

2023-06-05 15:01

viewer   ~75420

Fix committed to 5.x branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=34780

gabrieljenik

gabrieljenik

2023-06-08 14:50

manager   ~75476

PR with extra test on v5: https://github.com/LimeSurvey/LimeSurvey/pull/3201

LimeBot

LimeBot

2023-06-12 10:49

administrator   ~75544

Fixed in Release 5.6.26+230613

guest

guest

2023-06-13 15:46

viewer   ~75612

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=34809

guest

guest

2024-05-02 14:37

viewer   ~80066

Fix committed to 5.x branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=36317

Related Changesets

LimeSurvey: 5.x 01ac6e10

2023-06-05 17:01

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed (#3168)

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Affected Issues
18459
mod - application/models/Survey.php Diff File

LimeSurvey: master a9d6f855

2023-06-13 17:32

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed (#3167)

* Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed

* Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed

Tests added.

* Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed

Test for multiple surveys added.

* Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed

Test for any survey group id added.

* Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed

Survey count error fixed.

* DEV: Review test failure

* DEV: Review failing test

* DEV: Review failing test

* DEV: Review failing test

* DEV: Review failing test

* DEV: Review failing test

---------

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Affected Issues
18459
mod - application/models/Survey.php Diff File
add - tests/unit/models/SurveySearchTest.php Diff File

LimeSurvey: 5.x b423f2d8

2024-05-02 16:21

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 18459: When filtering the survey list by a parent survey group, surveys assigned to a child survey group are not listed (#3201) Affected Issues
18459
add - tests/unit/models/SurveySearchTest.php Diff File

Issue History

Date Modified Username Field Change
2022-11-05 12:59 Mazi New Issue
2022-11-05 12:59 Mazi File Added: image.png
2022-11-05 12:59 Mazi File Added: image-2.png
2022-11-07 14:22 gabrieljenik Status new => confirmed
2023-04-11 12:21 Mazi Note Added: 74457
2023-04-11 12:21 Mazi Bug heat 0 => 2
2023-04-11 13:11 ollehar Assigned To => gabrieljenik
2023-04-11 13:11 ollehar Status confirmed => assigned
2023-04-11 13:11 ollehar Priority none => normal
2023-04-21 20:15 gabrieljenik Note Added: 74591
2023-04-21 20:15 gabrieljenik Bug heat 2 => 4
2023-05-11 15:24 gabrieljenik Status assigned => feedback
2023-05-11 15:40 Mazi Note Added: 74933
2023-05-11 15:40 Mazi Status feedback => assigned
2023-05-11 16:38 gabrieljenik Note Added: 74934
2023-05-11 16:51 Mazi Note Added: 74935
2023-05-11 16:56 gabrieljenik Note Added: 74936
2023-05-11 18:06 Mazi Note Added: 74937
2023-05-12 10:00 ollehar Note Added: 74942
2023-05-12 10:00 ollehar Bug heat 4 => 6
2023-05-12 10:01 ollehar Note Added: 74943
2023-05-12 13:57 gabrieljenik Note Added: 74952
2023-05-12 14:02 ollehar Note Added: 74953
2023-05-12 14:02 ollehar Note Edited: 74953
2023-05-12 14:50 Mazi Note Added: 74954
2023-05-12 14:52 ollehar Note Added: 74955
2023-05-12 14:52 ollehar Note Edited: 74955
2023-05-12 16:28 DenisChenu Note Added: 74956
2023-05-12 16:28 DenisChenu Bug heat 6 => 8
2023-05-17 22:08 gabrieljenik Note Added: 75049
2023-05-17 22:09 gabrieljenik Note Edited: 75049
2023-05-17 23:17 gabrieljenik Assigned To gabrieljenik => DenisChenu
2023-05-17 23:17 gabrieljenik Status assigned => ready for code review
2023-05-19 10:15 DenisChenu Assigned To DenisChenu => gabrieljenik
2023-05-19 10:15 DenisChenu Status ready for code review => ready for testing
2023-05-19 10:15 DenisChenu Note Added: 75098
2023-05-21 20:18 Mazi Note Added: 75126
2023-05-22 08:52 DenisChenu Note Added: 75127
2023-05-22 08:52 DenisChenu File Added: Peek 22-05-2023 08-51.gif
2023-05-22 14:31 gabrieljenik Note Added: 75134
2023-05-22 14:50 DenisChenu Note Added: 75136
2023-05-23 22:59 gabrieljenik Note Added: 75202
2023-05-24 21:39 gabrieljenik Note Added: 75220
2023-05-25 08:33 DenisChenu Note Added: 75221
2023-05-25 10:57 ollehar Note Added: 75222
2023-05-25 10:57 ollehar Note Added: 75223
2023-05-25 11:55 DenisChenu Note Added: 75224
2023-05-25 13:58 gabrieljenik Note Added: 75227
2023-06-05 15:01 Changeset attached => LimeSurvey 5.x 01ac6e10
2023-06-05 15:01 guest Note Added: 75420
2023-06-05 15:01 guest Bug heat 8 => 10
2023-06-05 15:07 tibor.pacalat Assigned To gabrieljenik => tibor.pacalat
2023-06-05 15:07 tibor.pacalat Status ready for testing => in testing
2023-06-08 14:50 gabrieljenik Note Added: 75476
2023-06-12 10:49 LimeBot Note Added: 75544
2023-06-12 10:49 LimeBot Status in testing => closed
2023-06-12 10:49 LimeBot Resolution open => fixed
2023-06-12 10:49 LimeBot Bug heat 10 => 12
2023-06-12 14:57 gabrieljenik Status closed => ready for merge
2023-06-13 15:32 tibor.pacalat Status ready for merge => closed
2023-06-13 15:46 Changeset attached => LimeSurvey master a9d6f855
2023-06-13 15:46 guest Note Added: 75612
2024-05-02 14:37 Changeset attached => LimeSurvey 5.x b423f2d8
2024-05-02 14:37 guest Note Added: 80066