Blocks: Ranking block

block_ranking
Maintained by Willian Mano
A ranking block to improve the gamification into the course.
725
446
22
Moodle 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9

Moodle Ranking block repository

VERSION 2

This block improves gamefication into the moodle plataform.

This new version is more simpler and easy to use, but, with more visual.

The plugin works listening moodle events, so now, the points are added in real time.

The ranking works with the activity completion tracking, so you need to enable that and configure the criterias for all activities you want to monitor. The plugin only add points to activities with completion criterias. The method to add points remains the same.

There are different ways to gain points.

For example:

• If a student completes a html page the ranking adds 2 points.
• If a student completes an assignment and it is ended only when the student receive a grade. The ranking add 2 points plus the grade points to the student. You can configure the default points in the block configuraion.

NOTE: All the activities that needs grade to be finished will add the activity points (default 2) more the activity grade. For example: If the course has one assignment and it's configured to be completed only after the grade is received by the student and let's say a random student received by the end of the assignment 10(ten) as his grade. In this case that student will obtain 12(twelve) points, the 2(two pre-configured) from finishing the activity plus 10(ten) from his grade.

This only occurs with activities that have grades. ex: foruns, assignments, lessons, etc...

Update Notes

• Added event listeners to add point
• Removed cron dependency
• Added a weekly ranking
• Added a monthly ranking
• Added a tiny report with top 100 students in general ranking
• Added filter the tiny report by groups (the course group mode needs to be "separeted groups" or "visible groups")
• Now you don't need configure the course completion tracking, only the activities completion criterias. Again, the plugin only monitors the activities with completion criteria
• The table ranking_cmc_mirror was removed.

Installation

First way

• Clone this repository into the folder blocks.
• Access the notification area in moodle and install

Second way

• Extract the content
• Put the folder into the folder blocks of your moodle
• Access the notification area in moodle and install

Post instalation

After you have installed the block you just add it into the moodle course.

The ranking block works together with the activity completion, so you need to enable that and configure the criterias for all activities you want to monitor. The ranking block monitors these activities and add points to the students based on accomplishing the activities.

Enabling completion tracking

• Go to: Site administration / Advanced features
• Turn on the item "Enable completion tracking"
• Inside the course go to: Course administration / Edit settings
• In the section Completion tracking set "Completion tracking" to yes
• Save

Contributors

Willian Mano (Lead maintainer)
Please login to view contributors details and/or to contact them

• Sat, Oct 3, 2015, 1:47 AM
Great work, Willian! One question:

I installed the Ranking Block this week (works perfectly).

However, it seems to only recognize tasks completed SINCE it was installed. Is there a way to update the rankings with ALL of the course data, or to refresh the course data to register on the ranking block?

Thank you,
William Michael
Classical Liberal Arts Academy
• Thu, Nov 5, 2015, 5:19 AM
Hi, Looks like a great plug-in. Thanks for this and all of the follow up. I was wondering if there is any plug-in that would show a team's aggregate points in a leader board. So rather than individual grades and points placing one person at top of the class (or the bottom ) a team could be working together to beat another team. This could still have the motivation of gamification but not the negative of reinforcing the negative experiences.
• Fri, Nov 13, 2015, 1:12 AM
Hi there,
It works like a charm, my students love it. Thank you. Can I make a ranking block for several certain courses? If so, how can I make it?
Thank you,
• Thu, Nov 19, 2015, 1:19 AM
Olá.
Quando adiciono o bloco na página do curso simplesmente gera um erro ao ler base de dados.
No debug deu o seguinte:

Debug info: ERRO: coluna "u.picture" deve aparecer na cláusula GROUP BY ou ser utilizada em uma função de agregação
LINE 2: DISTINCT u.id,u.picture,u.firstname,u.lastna...
^
SELECT
sum(rl.points) as points
FROM
mdl_user u
INNER JOIN mdl_role_assignments a ON a.userid = u.id
INNER JOIN mdl_ranking_points r ON r.userid = u.id AND r.courseid = $1 INNER JOIN mdl_ranking_logs rl ON rl.rankingid = r.id INNER JOIN mdl_context c ON c.id = a.contextid WHERE a.contextid =$2
AND a.userid = u.id
AND a.roleid = $3 AND c.instanceid =$4
AND r.courseid = $5 AND rl.timecreated BETWEEN$6 AND \$7
GROUP BY u.id
ORDER BY points DESC, u.firstname ASC
LIMIT 10
[array (
0 => '5',
1 => '1346',
2 => 5,
3 => '5',
4 => '5',
5 => 1447545600,
6 => 1447852189,
)]
Stack trace:

line 407 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 239 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
line 708 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 135 of /blocks/ranking/lib.php: call to pgsql_native_moodle_database->get_records_sql()
line 83 of /blocks/ranking/block_ranking.php: call to block_ranking_get_students_by_date()
line 281 of /blocks/moodleblock.class.php: call to block_ranking->get_content()
line 232 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
line 937 of /lib/blocklib.php: call to block_base->get_content_for_output()
line 989 of /lib/blocklib.php: call to block_manager->create_block_contents()
line 352 of /lib/blocklib.php: call to block_manager->ensure_content_created()
line 5 of /theme/ftecflorense/layout/default.php: call to block_manager->region_has_content()
line 768 of /lib/outputrenderers.php: call to include()
line 715 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 232 of /course/view.php: call to core_renderer->header()

O que posso fazer pra resolver?
• Tue, Dec 15, 2015, 6:02 PM
Hi WIllian,

Thank you for your plug-in. I have a question about the first screenshot on this plugin presentation. How did you display items in "course information" ("guias e manuals", "biblioteca virtual", "cafe virtual", etc.) ?
It's a theme feature ?

Best regards.
• Tue, Dec 15, 2015, 7:12 PM
Yeah Clement. This is a Theme feature. I've added the font awesome in the theme, and i only have to add a div with the desired classes.
• Tue, Dec 15, 2015, 7:14 PM
Olá mauricio, você pode me dizer quais tecnologias está usando? Banco de dados, versão do moodle... Preciso disso para poder criar um ambiente testável e tentar resolver esse erro.
• Fri, Dec 18, 2015, 6:34 PM
Hi William,

First of all, thank you for maintaining this great plugin. Please, could you update plugin info with the latest changelog? I'm talking about September 18th release (today).
• Fri, Dec 18, 2015, 9:22 PM
Emiliom, did you want to say december 18th. right? I will update the changelog. For that release in specific i've only tested the plugin on moodle 3 and validate it. No errors were found.
• Fri, Dec 18, 2015, 9:27 PM
phuong hoang, You can add the block in each course. The points are separated.
• Fri, Dec 18, 2015, 9:28 PM
Ray O'Brien, that was a very interesting idea, and i am thinking about how to implement that. thanks
• Tue, Jan 12, 2016, 3:34 AM
Hi Willian I've installed and reinstalled twice. My moodle version is 3.0, my server works with database Mysql version 5.0.10 and PHP version 5.4.25. My cronjob is running. I see the plugin in the plugin overview. Which page would the ranking block be shown? Dashboard, courses, site home, etc. It does not show up as a block to add in the drop down menu. Any advice?
• Thu, Jan 21, 2016, 6:08 AM
Hey sonia. The newest version dont need the cron and the ranking is showed in the course page.
• Tue, Jan 26, 2016, 2:40 PM
Hello William. Thanks for the very nice plugins, but unfortunately I have some issue with it. Whenever a student finishes a quiz the ranking does not update the score of the students, the score of my students is always 0. What could be the problem here?
My moodle version is 3.0, then I already followed the steps on Enabling completion tracking. And I did not change the score settings of the ranking block.
• Sat, Feb 6, 2016, 1:16 AM
This is an excellent plugin and thanks for it so much,
I just would like to raise the same request in a previous request as below

Ray O'BrienThu, Nov 5, 2015, 5:19 AM
Hi, Looks like a great plug-in. Thanks for this and all of the follow up. I was wondering if there is any plug-in that would show a team's aggregate points in a leader board. So rather than individual grades and points placing one person at top of the class (or the bottomsad ) a team could be working together to beat another team. This could still have the motivation of gamification but not the negative of reinforcing the negative experiences.