View Issue Details

IDProjectCategoryView StatusLast Update
16673Bug reportsPluginspublic2020-09-22 16:04
Reporterasshank Assigned Tocdorin  
PrioritynoneSeveritytweak 
Status assignedResolutionopen 
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.
Complete LimeSurvey version number (& build)4.3.16
I will donate to the project if issue is resolvedNo
Sync to Zoho Project
BrowserN.A.
Database & DB-VersionN.A.
Server OS (if known)Centos 7
Webserver software & version (if known)apache
PHP Version7.4

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

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

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

DenisChenu

DenisChenu

2020-09-21 15:39

developer   ~59905

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

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

DenisChenu

DenisChenu

2020-09-21 15:46

developer   ~59910

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

this issue should also be addressed to 3xLTS

DenisChenu

DenisChenu

2020-09-22 08:51

developer   ~59917

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

developer   ~59925

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

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

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 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