View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
06454Bug reportsSurvey participants (Tokens)public2012-11-30 09:16
Reporterlolo Assigned Tomdekker  
PrioritynormalSeverityminor 
Status closedResolutionduplicate 
Product Version2.00RC8 
Fixed in Version2.00+ 
Summary06454: Central Participant Database: Sorting of participants in grid is local only
Description

In the list of participants (jqGrid), the column sorting is local to the displayed items only and not to the whole list of participants.

For instance, if sorting by first name, and with a total number of participants higher than the current display size (25 items by default), each screen may contain items from A to Z.

Best would be to sort items first (while fetching items from database), then paginate. Currently the process is the other way round (paginate first, then sort).

From a technical standpoint, it should be possible to perform thoses tasks at database level (sorting and pagination) without the need to have all elements in memory.

Steps To Reproduce
  • Have a number of participants > 25 in panel
  • Display list of participants (by default, 25 items are displayed)
  • Sort by first name
    => items are sorted A-Z
  • click next to display next items
    => list contains other items from A to Z
TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)120803
I will donate to the project if issue is resolvedNo
BrowserMozilla 14.0.1 (Win)
Database type & versionMysql 5.5.24
Server OS (if known)Linux 2.6.27.52
Webserver software & version (if known)Apache 2
PHP Version5.3.14

Relationships

related to 06956 closedmdekker Sorting Participant list only sorts visible entries 

Users monitoring this issue

lolo

Activities

jcleeland

jcleeland

2012-08-09 15:05

reporter   ~20310

This is a known issue, and something I'm leaving for future releases. The attributes are not stored in the same table but rather stored vertically in the attribute_values table. This is an efficient storage method for an unlimited number of attributes, but is not so efficient for simple retrieval and sorting tasks. Since sorting cannot be done at the database end, and instead needs to happen after retrieval by the scripts. I want to investigate different methods of managing this.

lolo

lolo

2012-08-09 18:27

reporter   ~20319

I guess a query like the following could be used. It does the sorting and the pagination in a single SQL query (example with 2 attributes only):

select p.*, a1.value as 'attr1', a2.value as 'attr2'
from lime_participants p
left join lime_participant_attribute a1 on (a1.participant_id=p.participant_id and a1.attribute_id=1)
left join lime_participant_attribute a2 on (a2.participant_id=p.participant_id and a2.attribute_id=2)
order by a1.value
limit 0,25

Of course the list of attributes (names and ids) has to be fetched beforehand in a separate query in order to build the list of columns to select (and tables to join with).

Hope it can give you ideas...

jcleeland

jcleeland

2012-08-10 01:43

reporter   ~20326

Awesome, thanks @lolo - since the sorting is only ever done by one column - we could just do one join like this for the column being sorted and keep collecting the remainder of the data the other way. :-)

lolo

lolo

2012-08-10 11:23

reporter   ~20335

Glad to be helpful.
By applying these techniques you could have it all -attributes names and values- in one or two queries instead of n, which will scale better with large amounts of data.
As the saying goes "if you torture SQL long enough, it will confess" ;)

mdekker

mdekker

2012-11-30 09:16

reporter   ~22724

Fixed it in another bug that i related so marking the original that I missed as duplicate. Searching is still to be fixed, but there is another bug open for that.

The fixes are not released yet so if you want to test, please check out the latest source on github. Feel free to reopen or comment on the other bugreport (6956).

Issue History

Date Modified Username Field Change
2012-08-09 09:54 lolo New Issue
2012-08-09 12:38 c_schmitz Assigned To => jcleeland
2012-08-09 12:38 c_schmitz Status new => assigned
2012-08-09 15:05 jcleeland Note Added: 20310
2012-08-09 18:27 lolo Note Added: 20319
2012-08-10 01:43 jcleeland Note Added: 20326
2012-08-10 11:23 lolo Note Added: 20335
2012-10-10 10:12 lolo Issue Monitored: lolo
2012-11-20 20:18 machaven Assigned To jcleeland => machaven
2012-11-30 09:12 mdekker Relationship added related to 06956
2012-11-30 09:16 mdekker Note Added: 22724
2012-11-30 09:16 mdekker Status assigned => closed
2012-11-30 09:16 mdekker Assigned To machaven => mdekker
2012-11-30 09:16 mdekker Resolution open => duplicate
2012-11-30 09:16 mdekker Fixed in Version => 2.00+
2016-12-08 10:39 c_schmitz Category Tokens => Survey participants (Tokens)
2021-08-02 23:04 guest Bug heat 6 => 8