View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
16673Bug reportsPluginspublic2021-03-29 12:37
Reporterasshank Assigned Top_teichmann  
PrioritylowSeveritytweak 
Status closedResolutionfixed 
Product Version4.3.16 
Summary16673: afterFindSurvey is fired multiple times
Description

The afterFindSurvey event is fired every type a Question is rendered (it seems).

I stumbled upon this, because I used a sendmail option in a plugin on the event.
And it fired a lot of emails in rapid succession (the survey contained more then 500 questions :-) ).

Steps To Reproduce

N.A.

Additional Information

You should expect it to fire once, I guess

@denis: BTW https://manual.limesurvey.org/AfterFindSurvey should state 4.3.16 also!

TagsNo tags attached.
Bug heat14
Complete LimeSurvey version number (& build)4.3.16
I will donate to the project if issue is resolvedNo
BrowserN.A.
Database type & versionN.A.
Server OS (if known)Centos 7
Webserver software & version (if known)apache
PHP Version7.4

Users monitoring this issue

DenisChenu

Activities

asshank

asshank

2020-09-18 11:52

reporter   ~59873

Not only after question render! The survey I tested fired 3748 times! (767 questions)

DenisChenu

DenisChenu

2020-09-19 18:49

developer   ~59885

Last edited: 2021-02-07 12:26

Maybe we can move it to the satci part of find ?

twigreneder seems to happen a lot too.

asshank

asshank

2020-09-19 21:07

reporter   ~59887

Last edited: 2021-02-07 12:26

It wil reduce processor cycles! It is massive! Who knows: renderspeed improvement?

DenisChenu

DenisChenu

2020-09-21 15:39

developer   ~59905

Last edited: 2021-02-07 12:26

With Sample survey https://github.com/LimeSurvey/LimeSurvey/blob/master/docs/demosurveys/ls3_sample_survey_multilingual_fr_de_en_it.lss
Set "All in one page"

afterFindSurvey happen

  • in 3.X : 2 times
  • in 4.3.16 : 430 times

There are clearly a new issue here.

Plugin used : https://gitlab.com/SondagesPro/TestDemoAndDevel/checkAfterFindSurvey/-/blob/master/checkAfterFindSurvey.php

DenisChenu

DenisChenu

2020-09-21 15:41

developer   ~59907

Last edited: 2021-02-07 12:26

But more :! my 3.X version for testing have already a lot of plugins …

DenisChenu

DenisChenu

2020-09-21 15:46

developer   ~59910

Last edited: 2021-02-07 12:26

Seems we don't use findByPk in 3.X on some function.

We must use findByPk … for Survey (and anywhere it's possible)

bismark

bismark

2020-09-21 21:19

reporter   ~59912

Last edited: 2021-02-07 12:26

this issue should also be addressed to 3xLTS

DenisChenu

DenisChenu

2020-09-22 08:51

developer   ~59917

Last edited: 2021-02-07 12:26

No : 3LTS : event happen 2 times only, no real issue in LTS. Can be improved, but still no a real issue.

Did you test my plugin ?

gabrieljenik

gabrieljenik

2020-09-22 15:34

manager   ~59925

Last edited: 2021-02-07 12:26

Strange. I don't see why it is called so few times on LSv3 if the event happens afterFind.

As per the definition of the manual, I would just trigger the event manually from the survey taking side, instead of attaching it to the find method, which could be triggered from the admin side as well.

Am I right? Or am I missing something?

DenisChenu

DenisChenu

2020-09-22 16:04

developer   ~59926

Last edited: 2021-02-07 12:26

findByPk don't throw afterFind event.
Usage of static variable.

I would just trigger the event manually from the survey taking side, instead of attaching it to the find method,

Plugin can need to update attribute each time it was loaded. Even o admin part : it don't happen a lot, 3 times for Survey settings. Currently plugin event happen in admin , stay in admin please …

Dev can control where it's call with Yii::app()->getController()->getId()

See https://gitlab.com/SondagesPro/mailing/adminNotificationHtmlAnswerTable/-/blob/master/adminNotificationHtmlAnswerTable.php#L232

DenisChenu

DenisChenu

2021-03-25 12:35

developer   ~63598

@p_teichmann : warning : if you update this : you broke API and potential plugin …

@gabrieljenik

As per the definition of the manual, I would just trigger the event manually from the survey taking side, instead of attaching it to the find method, which could be triggered from the admin side as well.

Right about manual : but need a model->afterFind event. Maybe

  1. Create a new afterPublicFindSurvey
  2. Update manual page
p_teichmann

p_teichmann

2021-03-26 15:13

administrator   ~63655

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

lime_release_bot

lime_release_bot

2021-03-29 12:31

administrator   ~63686

Fixed in Release 4.4.15+210329

DenisChenu

DenisChenu

2021-03-29 12:37

developer   ~63697

Manual fixed : https://manual.limesurvey.org/index.php?title=AfterFindSurvey&type=revision&diff=161387&oldid=154072

Related Changesets

LimeSurvey: master 6ef50d65

2021-03-26 10:01:02

p_teichmann

Details Diff
Fixed issue 16673: afterFindSurvey fired to many times Affected Issues
16673
mod - application/models/QuestionAttribute.php Diff File

LimeSurvey: master 43c52d3a

2021-03-26 15:12:52

c_schmitz

Details Diff
Fixed issue 16673: Plugin event afterFindSurvey is fired too many times Affected Issues
16673
mod - application/models/QuestionAttribute.php Diff File

Issue History

Date Modified Username Field Change
2020-09-18 11:09 asshank New Issue
2020-09-18 11:52 asshank Note Added: 59873
2020-09-19 18:49 DenisChenu Issue Monitored: DenisChenu
2020-09-19 18:49 DenisChenu Note Added: 59885
2020-09-19 21:07 asshank Note Added: 59887
2020-09-21 15:39 DenisChenu Note Added: 59905
2020-09-21 15:41 DenisChenu Note Added: 59907
2020-09-21 15:41 DenisChenu File Added: limesurvey_survey_SampleAllInOne.lss
2020-09-21 15:41 DenisChenu Assigned To => cdorin
2020-09-21 15:41 DenisChenu Status new => assigned
2020-09-21 15:42 DenisChenu Severity minor => tweak
2020-09-21 15:46 DenisChenu Note Added: 59910
2020-09-21 21:19 bismark Note Added: 59912
2020-09-22 08:51 DenisChenu Note Added: 59917
2020-09-22 15:34 gabrieljenik Note Added: 59925
2020-09-22 16:04 DenisChenu Note Added: 59926
2020-09-22 16:04 DenisChenu File Added: Capture d’écran du 2020-09-22 16-02-13.png
2021-02-04 10:15 cdorin Status assigned => new
2021-02-07 12:26 cdorin Assigned To cdorin =>
2021-02-07 12:26 cdorin Priority none => low
2021-02-07 12:26 cdorin Status new => confirmed
2021-02-07 12:26 cdorin Sync to Zoho Project => |Yes|
2021-03-25 12:30 p_teichmann Assigned To => p_teichmann
2021-03-25 12:30 p_teichmann Status confirmed => assigned
2021-03-25 12:35 DenisChenu Note Added: 63598
2021-03-26 15:13 c_schmitz Changeset attached => LimeSurvey master 43c52d3a
2021-03-26 15:13 p_teichmann Changeset attached => LimeSurvey master 6ef50d65
2021-03-26 15:13 p_teichmann Note Added: 63655
2021-03-26 15:13 p_teichmann Resolution open => fixed
2021-03-29 12:31 lime_release_bot Sync to Zoho Project Yes => |Yes|
2021-03-29 12:31 lime_release_bot Note Added: 63686
2021-03-29 12:31 lime_release_bot Status assigned => closed
2021-03-29 12:37 DenisChenu Note Added: 63697
2021-08-06 04:20 guest Bug heat 12 => 14