View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 05042 | Bug reports | Survey editing | public | 2011-03-19 00:48 | 2011-04-11 11:30 |
| Reporter | JoyLaneResearch | Assigned To | jcleeland | ||
| Priority | low | Severity | tweak | ||
| Status | closed | Resolution | fixed | ||
| Product Version | 1.90+ | ||||
| Fixed in Version | 1.91RC6 | ||||
| Summary | 05042: GSOC: Too many on-screen headings in an array using array filter | ||||
| Description | I have a survey that asks which of 120 stores respondents have shopped (multiple options). A follow-up question asks ratings of stores shopped (array, using an array filter). My system is set to repeat headings in a table every eight rows. The follow-up question still has all the heading rows, even though it doesn't have all the stores. Is there a workaround? Thanks! | ||||
| Steps To Reproduce |
| ||||
| Tags | No tags attached. | ||||
| Attached Files | bug 05042.patch (3,618 bytes)
Index: qanda.php
===================================================================
--- qanda.php (revision 9945)
+++ qanda.php (working copy)
@@ -1360,6 +1360,60 @@
return $output;
}
+function return_array_filter_selected($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null)
+// function which returns TRUE if the given $ansrow contains a row which is selected, ie, not filtered out in previous answer
+{
+ $filter_select = TRUE;
+ if
+ (
+ (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set
+ $thissurvey['format'] == 'S' // and the survey is being presented in question-by-question mode
+ ) || // OR
+ (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set
+ $thissurvey['format'] == 'G' && // and the survey is being presented in group-by-group mode
+ getArrayFiltersOutGroup($ia[0]) == true // and the source question for the array filter is in a different group than this question
+ )
+ )
+ {
+ $selected = getArrayFiltersForQuestion($ia[0]);
+ if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
+ if (!empty($selected) && !in_array($ansrow['title'],$selected))
+ {
+ $filter_select = FALSE;
+ }
+ else
+ {
+ $filter_select = TRUE;
+ }
+ }
+
+ if
+ (isset($qidattributes['array_filter_exclude']) &&
+ (
+ (trim($qidattributes['array_filter_exclude'])!='' &&
+ $thissurvey['format'] == 'S'
+ ) ||
+ (trim($qidattributes['array_filter_exclude'])!='' &&
+ $thissurvey['format'] == 'G' &&
+ getArrayFiltersExcludesOutGroup($ia[0]) == true
+ )
+ )
+ )
+ {
+ $selected = getArrayFilterExcludesForQuestion($ia[0]);
+ if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
+ if (!empty($selected) && !in_array($ansrow['title'],$selected))
+ {
+ $filter_select = TRUE;
+ }
+ else
+ {
+ $filter_select = FALSE;
+ }
+ }
+ return $filter_select;
+}
+
function return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) {
/* We're just going to work out whether to do the include or exclude version of the function at this point */
if(isset($qidattributes['array_filter_exclude']) && trim($qidattributes['array_filter_exclude']) != '') {
@@ -5987,7 +6041,6 @@
}
}
$myfname = $ia[1].$ansrow['title'];
- $trbc = alternation($trbc , 'row');
$answertext=dTexts::run($ansrow['question']);
$answertextsave=$answertext;
if (strpos($answertext,'|'))
@@ -6005,7 +6058,13 @@
}
// Get array_filter stuff
list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow, $myfname, $trbc, $myfname);
- $answer .= $htmltbody2;
+ $row_selected = return_array_filter_selected($ia, $qidattributes, $thissurvey, $ansrow, $myfname, $trbc, $myfname);
+ if($row_selected)
+ {
+ $trbc = alternation($trbc , 'row');
+ $fn++;
+ }
+ $answer .= $htmltbody2;
$answer .= "<tr class=\"$trbc\">\n"
. "\t<th class=\"answertext\">\n$answertext"
@@ -6062,7 +6121,6 @@
$answer .= "</tr>\n";
$inputnames[]=$myfname;
//IF a MULTIPLE of flexi-redisplay figure, repeat the headings
- $fn++;
}
$answer_cols = "\t<colgroup class=\"col-responses\">\n"
| ||||
| Bug heat | 8 | ||||
| Complete LimeSurvey version number (& build) | 9642 | ||||
| I will donate to the project if issue is resolved | No | ||||
| Browser | IE8 and FF3.6 | ||||
| Database type & version | MySQL 5-something | ||||
| Server OS (if known) | LS is on RedHat Linux, browser is on Windows 7 | ||||
| Webserver software & version (if known) | Rackspace | ||||
| PHP Version | 5.2 | ||||
| Git branch / Pull Request URL | |||||
|
There is also a similar array filter problem when highlighting lines at a following array question. Depending on the number of remaining answers at the following question the color alternation doesn't work properly. |
|
|
Hi, I have also attached a test survey structure(limesurvey_survey_62432.lss), which exhibits the bug in question. |
|
|
Jason, can you please have a look at the patch!? |
|
|
Hi anurag89, could you post your whole qanda.php file, I'm having all sorts of problems using the patch file (probably not your fault), but it'll be easier for me to just do a merge between two file versions to check this out. Thanks, Jason |
|
|
Hi Jason, Thanks, |
|
|
Thanks Anurag, I've tested the fix and committed it to SVN. Nice work :-) |
|
|
Thanks to Anurag/Anurag89 for this fix |
|
|
Oh, Mazi - could you create the bug relating to the alternating colours and label it GSOC? Thanks! |
|
|
New ticket opened: http://bugs.limesurvey.org/view.php?id=5087 |
|
|
Thanks for the appreciation... :-) but i had also fixed the alternating color problem in this patch, since i had already seen mazi's comment... You can check it out... Thanks, |
|
|
1.91RC6 released. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2011-03-19 00:48 | JoyLaneResearch | New Issue | |
| 2011-03-21 00:36 | Mazi | Assigned To | => jcleeland |
| 2011-03-21 00:36 | Mazi | Status | new => assigned |
| 2011-03-21 00:36 | Mazi | Note Added: 14483 | |
| 2011-03-24 19:01 |
|
Issue Monitored: user12741 | |
| 2011-03-26 17:47 | Mazi | Summary | Too many on-screen headings in an array using array filter => GSOC: Too many on-screen headings in an array using array filter |
| 2011-04-03 21:22 |
|
File Added: limesurvey_survey_62432.lss | |
| 2011-04-03 21:22 |
|
File Added: bug 05042.patch | |
| 2011-04-03 21:26 |
|
Note Added: 14639 | |
| 2011-04-04 20:02 | Mazi | Note Added: 14664 | |
| 2011-04-05 03:36 | jcleeland | Note Added: 14668 | |
| 2011-04-05 07:29 |
|
File Added: qanda.php | |
| 2011-04-05 07:31 |
|
Note Added: 14669 | |
| 2011-04-06 11:47 | jcleeland | Note Added: 14685 | |
| 2011-04-06 11:48 | jcleeland | Note Added: 14686 | |
| 2011-04-06 11:48 | jcleeland | Status | assigned => resolved |
| 2011-04-06 11:48 | jcleeland | Fixed in Version | => 1.91RC6 |
| 2011-04-06 11:48 | jcleeland | Resolution | open => fixed |
| 2011-04-06 11:49 | jcleeland | Note Added: 14687 | |
| 2011-04-06 12:14 | Mazi | Relationship added | related to 05087 |
| 2011-04-06 12:14 | Mazi | Note Added: 14689 | |
| 2011-04-06 18:10 |
|
Note Added: 14702 | |
| 2011-04-11 11:30 | c_schmitz | Note Added: 14748 | |
| 2011-04-11 11:30 | c_schmitz | Status | resolved => closed |
| 2019-11-01 17:25 | c_schmitz | Category | Survey design => Survey editing |