WordPress.org

Ready to get started?Download WordPress

Forums

SlickQuiz
Top widget order (6 posts)

  1. Ciao121
    Member
    Posted 5 months ago #

    My top widget show results not in "Top ranking" order.
    This is what I have:

    9 / 10 - Andrea Icardi
    8 / 10 - Johnny
    7 / 10 - Libano
    6 / 10 - Nico
    10 / 10 - isoliti
    10 / 10 - Marco Campanile

    How can I solve it? Thank you!

    https://wordpress.org/plugins/slickquiz/

  2. jewlofthelotus
    Member
    Plugin Author

    Posted 5 months ago #

    @Ciao121 - Hey, thanks for reporting this! I've heard this come up as an issue before and I think it might have something to do with the version of PHP or MySQL running on the server.

    I'll spend some time over the weekend looking into this and will let you know what I find.

  3. Ciao121
    Member
    Posted 5 months ago #

    I'm almost sure that the problem is that it's a varchar field:
    So if you order it by the first char is:
    9
    8
    7
    6
    1
    1
    But the last tow are 10 and not 1 ;)

  4. Ciao121
    Member
    Posted 5 months ago #

    I solved it by changing in slickquiz-widgets.php line 39
    From:
    $scores = $quizModel->get_all_scores( $instance['quiz_id'], 'score DESC, createdDate ASC', "LIMIT " . $instance['score_count'] );

    To:

    $scores = $quizModel->get_all_scores( $instance['quiz_id'], 'convert(score, decimal) DESC, createdDate ASC', "LIMIT " . $instance['score_count'] );

    Dont'k know if it work with every quiz. It work with my only one (10 questions).

  5. jewlofthelotus
    Member
    Plugin Author

    Posted 5 months ago #

    Thanks, @Ciao121. I've seen it sort properly for some and improperly for others, I will definitely try out your solution and see if it works in all scenarios.

  6. jewlofthelotus
    Member
    Plugin Author

    Posted 5 months ago #

    @Ciao121 - Thanks for the suggestion, it seems to be working perfectly! I've pushed out an update with the fix included. Look for v1.2.373 and let me know if that resolves it for you!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.