View Issue Details

This issue affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
04418Bug reportsSurvey takingpublic2010-07-06 11:22
Reporterjdalegonzalez Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionwon't fix 
Product Version1.87+ 
Summary04418: group.php loops through all questions every time it's called
Description

Around line 335 you'll see foreach ($_SESSION['fieldarray'] as $ia). What this means is that every time group.php is called, all questions will be traversed when only some will be part of the group in question. Since we're talking about memory traversal, this is probably not a huge deal until the number of questions gets very large - at which point having them all in memory might not work. In any case, it seems like it would be more efficient to either:

a) when $_SESSION['fieldarray'] is being built, make note of the question index that marks a group boundary and update $_SESSION['grouplist'] with this value and then change the foreach into something like for($i = $_SESSION['grouplist'][$grouparrayno]['firstqindex']; $i < count)($SESSION['fieldarray'];$i++) AND break as soon as $ia[5] != $gid
OR
b) rework
$SESSION['fieldarray'] to be 2 dimensional in the case of 'by group' display of the survey, making the foreach be something like... foreach ($_SESSION['fieldarray'][$gid] as $ia)
c) do neither but at least break out if the group has been found (ie one question for the group has been encountered in the loop) but $ia[5] for the current question is != $gid;
d) something else that allows a group just to look at its own questions.

Steps To Reproduce

scan down to line 335 and verify my contention.

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)7987
I will donate to the project if issue is resolved
Browserall
Database type & versionall
Server OS (if known)all
Webserver software & version (if known)all
PHP Versionall
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2010-06-17 00:42

administrator   ~12238

I don't think this is a big deal because a couple lines further in the foreach loop the Group ID is tested and if it does not match the foreach is continued.
The $_SESSION['fieldarray'] is completely held in memory anyway - i have yet to encounter a survey where that does/did not work.

Issue History

Date Modified Username Field Change
2010-06-14 20:30 jdalegonzalez New Issue
2010-06-14 20:30 jdalegonzalez Status new => assigned
2010-06-14 20:30 jdalegonzalez Assigned To => user372
2010-06-17 00:42 c_schmitz Note Added: 12238
2010-06-17 00:44 c_schmitz Status assigned => resolved
2010-06-17 00:44 c_schmitz Resolution open => won't fix
2010-06-17 00:44 c_schmitz Assigned To user372 => c_schmitz
2010-07-06 11:22 c_schmitz Status resolved => closed
2010-10-25 00:18 c_schmitz Category Survey at Runtime => Survey taking