Limit Quiz Submission

Hi,


Is it possible to limit the number of Quiz Submission?



For example if I wanted to receive only 1000 unique submissions and close the poll?





Thanks.

[quote]
Hi,



Is it possible to limit the number of Quiz Submission?



For example if I wanted to receive only 1000 unique submissions and close the poll?





Thanks.

[/quote]





Hi,



I don't see a direct way of doing this but it isn't not-doable. If it there is no other bright option would create a trigger to fire on link created event, with condition to match submission asset under submissions folder. Done this it would be fairly simple to write a DB query (or a stored procedure) to count the number of links under the submissions folder, and if it has reached certain number then change the asset status to under construction. Making the asset status under construction will help you to hide it from public user (if that's what you intend to do). Archiving the asset would be another option too.



Hope that help.



Cheers,

Ash

How about you create an asset listing that lists how many submission assets the quiz has, then nest that in your first quiz page. Then, use some JS to check that number and if it is > 1000 just hide the form.

Hi,


Thanks for the reply, I think Ashish work around sounds more suitable.



I was thinking of using the Quiz Asset to create a 1000 free drinks voucher. To get the voucher the user would have to be registered and 1 voucher per person basis.



To eliminate the problem of someone requesting the voucher multiple times the Quiz Asset can be used so it can be requested (filled out) only once and to overcome the the 1000 free voucher limit Ashish suggestion might work.





Now where do I start with querying Matrix with PostgresSQL? :frowning:

[quote]
Hi,



Thanks for the reply, I think Ashish work around sounds more suitable.



I was thinking of using the Quiz Asset to create a 1000 free drinks voucher. To get the voucher the user would have to be registered and 1 voucher per person basis.



To eliminate the problem of someone requesting the voucher multiple times the Quiz Asset can be used so it can be requested (filled out) only once and to overcome the the 1000 free voucher limit Ashish suggestion might work.





Now where do I start with querying Matrix with PostgresSQL? :frowning:

[/quote]



That is nice to hear the work around is suitable for you. For this to be achieved we would be looking at sq_ast_lnk_tree table which can directly give is number of kids for a particular asset.

    SELECT l.num_kids FROM sq_ast_lnk_tree l WHERE l.linkid IN (SELECT linkid FROM sq_ast_lnk WHERE minorid = 'XX');

Above will give you the number of submission which can be used in a IF condition. You will have to replace XX with your 'Submission' folder assetid.



To change Asset Status we have to look at sq_ast table. The query needs to get all the children assets of the Quiz Asset and set them to the same status. Following query can take care of it.

    UPDATE sq_ast SET status = '2' WHERE assetid IN (SELECT minorid FROM sq_ast_lnk WHERE majorid = 'XX' AND link_type IN ('1', '2')) OR assetid = 'XX';

Above query essentially sets the status to Under Construction ('2') by getting all the assets under the Quiz and itself too.



Hope the above helps. Any question please don't hesitate to ask me.



Cheers.