View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
18699 | Bug reports | Other | public | 2023-03-23 14:35 | 2023-08-09 16:39 |
Reporter | gabrieljenik | Assigned To | ollehar | ||
Priority | none | Severity | block | ||
Status | in code review | Resolution | open | ||
Product Version | 5.6.x | ||||
Summary | 18699: LSActiveRecord::getMaxId() doesn't get refreshed when using from SurveyDynamic with multiple surveys on the same HTTP request | ||||
Description | Caught while reviewing 18655 GJ: The diema is this is only happening on these tests as the model is used with different surveyIds within the same HTTP request. This is not happening on real life. DC: Until we use in in Question::model and Survey::model in same call … A workaround was implemented here for being able to use the remote_control->export_responses. | ||||
Steps To Reproduce | Steps to reproduceUndo this change Make a script for RC for exporting rsposnes from survey A and then from survey B. Expected resultSurvey B responses will be exported. Actual resultNo survey B responses will be exported. | ||||
Tags | No tags attached. | ||||
Bug heat | 8 | ||||
Complete LimeSurvey version number (& build) | 5.6.7 + 6 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | MySQL | ||||
Server OS (if known) | |||||
Webserver software & version (if known) | |||||
PHP Version | 8.0 | ||||
I would go with: 1- Add a new optional parameter to getMaxId 2 - Create LSActiveRecord::refreshMetadata() (overload of CActiveRecord). |
|
DC said... a lot must be automatic. If not : it's unusuable For example, you can do
You must have the real $maxId at each time. And more |
|
DC Said A question : did we really need this one ? Maybe just delete this statci var I think it's best to optimize other request (and use static or cache) https://bugs.limesurvey.org/view.php?id=18473 |
|
Not so easy … ;) |
|
haha I was trying to port the conversation :) |
|
Draft broken test : https://github.com/LimeSurvey/LimeSurvey/pull/3006 I like to keep some statci var when multiple load too For example : wen you ask Options for Survey #1 in Group #1 : you ask option in Survey #1 + option on Group #1 + Global option , the n if you as after option in Survey #2 : i like to keep option on Group #1 + Global option Same for Template option (where you can have more than on Global option …) maxIds is a good test for all of this ;) |
|
Is it ok if I take this? |
|
I think i get it I need to add same for minIds OK ? |
|
5.X : https://github.com/LimeSurvey/LimeSurvey/pull/3006 (already reviewed) Di i create test ? I create only if confirmed , don't want to create and must fix again in 6 month. |
|
@ollehar : did i create test ? If auto test is OK : can merge ? |
|
Are you sure this is not premature optimization? https://softwareengineering.stackexchange.com/questions/80084/is-premature-optimization-really-the-root-of-all-evil |
|
Alternative solution : reset if $dynamicId are updated. What is your proposed solution ? Issue still there. |
|
The solution with less code but worse performance is to never cache it in a local variable. |
|
But the trade-off with simpler code is worth it if performance is only very slightly affected. Depends on how often the code is called, if it's in a tight loop or so. |
|
Solutions
I can do 2 here. |
|
Maybe 1 is OK here |
|
Yes, assuming the export code is not in a loop? |
|
No, and remove the $forceRefresh then … |
|
Yep, not needed. :) |
|
Sorry got lost. What's wrong with Denis solution? My initial idea (https://bugs.limesurvey.org/view.php?id=18699#c74246) was to: 2 - Create LSActiveRecord::refreshMetadata() (overload of CActiveRecord). That can be complemented by making this variable inside the method By looking at Denis solution, now in DEV branch, I would also add some more stuff like:
|
|
@gabrieljenik : removing static var and no issue. Since don't seems to be used more than one time in action : we don't need a static var |
|
Could be. It would be inline with simplifying. It would remove the cache. Still, what's wrong with Denis solution? |
|
Is this ready for testing or not? I can't tell, because the discussion is still ongoing and this is tagged with "in code review", but PRs are tagged with "Code review done" :/ |
|
@DenisChenu Is this ready for testing or not? I can't tell, because the discussion is still ongoing and this is tagged with "in code review", but PRs are tagged with "Code review done" :/ |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2023-03-23 14:35 | gabrieljenik | New Issue | |
2023-03-23 14:35 | gabrieljenik | Issue generated from: 18655 | |
2023-03-23 14:35 | gabrieljenik | Relationship added | related to 18655 |
2023-03-23 14:36 | gabrieljenik | Description Updated | |
2023-03-23 14:37 | gabrieljenik | Note Added: 74246 | |
2023-03-23 14:37 | gabrieljenik | Bug heat | 0 => 2 |
2023-03-23 14:38 | gabrieljenik | Note Added: 74247 | |
2023-03-23 14:38 | gabrieljenik | Note Added: 74248 | |
2023-03-23 14:53 | DenisChenu | Note Added: 74250 | |
2023-03-23 14:53 | DenisChenu | Bug heat | 2 => 4 |
2023-03-23 15:37 | gabrieljenik | Note Added: 74251 | |
2023-03-23 15:41 | DenisChenu | Note Added: 74252 | |
2023-03-23 21:59 | gabrieljenik | Note Added: 74259 | |
2023-03-23 22:00 | gabrieljenik | Status | new => confirmed |
2023-03-24 09:04 | DenisChenu | Note Added: 74270 | |
2023-06-09 08:26 | DenisChenu | Note Added: 75504 | |
2023-06-09 08:26 | DenisChenu | Assigned To | => gabrieljenik |
2023-06-09 08:26 | DenisChenu | Status | confirmed => ready for code review |
2023-06-09 08:26 | DenisChenu | Complete LimeSurvey version number (& build) | 5.6.7 => 5.6.7 + 6 |
2023-06-09 14:57 | gabrieljenik | Assigned To | gabrieljenik => DenisChenu |
2023-06-09 14:57 | gabrieljenik | Status | ready for code review => ready for testing |
2023-06-13 09:35 | DenisChenu | Note Added: 75572 | |
2023-06-13 09:48 | ollehar | Note Added: 75573 | |
2023-06-13 09:48 | ollehar | Bug heat | 4 => 6 |
2023-06-13 09:58 | DenisChenu | Note Added: 75577 | |
2023-06-13 10:07 | ollehar | Note Added: 75578 | |
2023-06-13 10:08 | ollehar | Note Added: 75579 | |
2023-06-13 10:48 | DenisChenu | Note Added: 75583 | |
2023-06-13 10:48 | DenisChenu | Assigned To | DenisChenu => ollehar |
2023-06-13 10:48 | DenisChenu | Status | ready for testing => new |
2023-06-13 10:48 | DenisChenu | Status | new => in code review |
2023-06-13 11:08 | DenisChenu | Note Added: 75588 | |
2023-06-13 11:17 | ollehar | Note Added: 75589 | |
2023-06-13 11:25 | DenisChenu | Note Added: 75590 | |
2023-06-13 11:26 | ollehar | Note Added: 75591 | |
2023-06-13 14:31 | gabrieljenik | Note Added: 75600 | |
2023-06-13 15:13 | DenisChenu | Note Added: 75609 | |
2023-06-13 16:15 | gabrieljenik | Note Added: 75615 | |
2023-06-14 13:50 | tibor.pacalat | Note Added: 75623 | |
2023-06-14 13:50 | tibor.pacalat | Bug heat | 6 => 8 |
2023-08-09 16:39 | tibor.pacalat | Note Added: 76524 |