Asynchronous behaviour of db while creating new token

More
3 years 7 months ago #99278 by nicola86
Hi there,
I was wondering if the below method "updateToken" from the class /htdocs/application/models/Tokens_dynamic.php is an Asynchronous calling to the db. And what is the meaning of the return value?
function updateToken($tid,$newtoken)
{
 return Yii::app()->db->createCommand("UPDATE{$this->tableName()}SET token=:newtoken WHERE tid=:tid")
        ->bindParam(":newtoken", $newtoken, PDO::PARAM_STR)
        ->bindParam(":tid", $tid, PDO::PARAM_INT)
        ->execute();
    }

Please Log in to join the conversation.

More
3 years 7 months ago #99290 by nicola86
The problem is that in my application I use the token just after creating it(with the remote control method add_partecipants). Doing that I've noticed that it is necessary some delay between the creation of the token and the compiling of survey(using the new token). So that I've discovered that the method that generate the token, makes an update on the db through that method "updateToken" and just after returns the generated token. So the question is: is the update on the db asyncronous? Because only this behaviour would justify the message that I got when I don't give the "necessary" delay between creation/using of the token(the message says that the token doesn't exist)

Please Log in to join the conversation.

More
3 years 6 months ago #99312 by DenisChenu
Hi,

I don't think you really need delay ?

You need to properly renew the $_SESSION with the new token. How do you start the survey after creation ?

Try adding newtest/Y in url

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
3 years 6 months ago - 3 years 6 months ago #99315 by nicola86
Hi,
thanks for the answer. How do I renew the $_SESSION with the new token (through the remotecontrol of course)?

Try adding newtest/Y in url

You mean that I have to add to url of the survey "newtest/Y"
for example: SERVER_ADDRESS/index.php/survey/index/sid/ID_SURVEY/token/TOKEN/lang/LANGUAGE/newtest/Y
Is it right?

Thanks again,
Nicola
Last Edit: 3 years 6 months ago by nicola86.

Please Log in to join the conversation.

More
3 years 6 months ago #99405 by nicola86
Sorry I forgot to answer to one of your questions.

How do you start the survey after creation ?

After adding the partecipant I dinamically create the link of the survey with the right parameters and then I access on that page.
Anyway it seems that adding at the end of the url of the survey the string that you gave me: "newtest/Y" it works. But what does it means that string?

Please Log in to join the conversation.

More
3 years 6 months ago #99452 by DenisChenu

nicola86 wrote: Anyway it seems that adding at the end of the url of the survey the string that you gave me: "newtest/Y" it works. But what does it means that string?

It renew the survey SESSION.

A lot of survey answers and param are in SESSION, the if you come again to a survey but with different token: this one can not be renewed.

Nest is to always use newtest/Y

Newtest: Take a NEW survey on same browser

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.