Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add leaderboard for achievements. #2579

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

somiaj
Copy link
Contributor

@somiaj somiaj commented Sep 24, 2024

This adds a leaderboard for achievements, which ranks users from the greatest to the least number of achievement points along with showing the badges of all earned achievements.

The default use of this is to provide a summary page for professors to see how many achievement points students have earned along with which badges they have earned. The default permission level to view the leaderboard and see usernames on the leaderboard is professor.

The permission level for viewing the leaderboard and viewing names on the leaderboard can be changed under course configuration to allow students to see the leaderboard. It is noted that since achievement points are often closely related to grades, that this should be considered before allowing students access.

Note, this is currently a little slow since it loops over all students, and for each student loops over all achievements making multiple database calls to get the user achievement records. In my class of 40 students with 80 achievements, it takes about 5 seconds to generate the page, and could be slower for much larger classes. I would like to speed this up, but unsure on how to more efficiently make database calls to get all the achievement data needed to build the leaderboard.

@somiaj somiaj force-pushed the achievement-leader-board branch 4 times, most recently from 6ebf2c3 to 66f2ceb Compare September 29, 2024 03:37
@somiaj somiaj force-pushed the achievement-leader-board branch from 66f2ceb to d2141f3 Compare October 25, 2024 16:03
@somiaj somiaj force-pushed the achievement-leader-board branch from d2141f3 to 95843d5 Compare November 13, 2024 05:45
Copy link
Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several changes that are needed here. I also suggested some changes that should improve loading the needed data from the database some.

lib/WeBWorK/Utils/Routes.pm Outdated Show resolved Hide resolved
templates/HelpFiles/Leaderboard.html.ep Outdated Show resolved Hide resolved
lib/WeBWorK/ContentGenerator/Leaderboard.pm Outdated Show resolved Hide resolved
lib/WeBWorK/ContentGenerator/Leaderboard.pm Outdated Show resolved Hide resolved
lib/WeBWorK/ContentGenerator/Leaderboard.pm Outdated Show resolved Hide resolved
lib/WeBWorK/ContentGenerator/Leaderboard.pm Outdated Show resolved Hide resolved
lib/WeBWorK/ContentGenerator/Leaderboard.pm Outdated Show resolved Hide resolved
lib/WeBWorK/ContentGenerator/Leaderboard.pm Outdated Show resolved Hide resolved
lib/WeBWorK/ContentGenerator/Leaderboard.pm Outdated Show resolved Hide resolved
@drgrice1
Copy link
Member

Also, to take the "Leaderboard" to "Achievement Leaderboard" comments further, I think you should rename Leaderboard.pm and both Leaderboard.html.ep files to start with "Achievement". This makes it clear that these are associated with achievements for developers. Who knows, there may be some other kind of leaderboard created for something else in the future.

@somiaj
Copy link
Contributor Author

somiaj commented Nov 14, 2024

@drgrice1 thanks for your suggestions. I'll add them later. I did initially call this the "Achievement Leaderboard", but felt the name looked to long in the menu, and then I put "Leaderboard" indented under the "Achievements" link, but felt the offset looked odd, and ended up just calling it "Leaderboard" with no offset. I'll go change the name back, just sharing my thought process.

@drgrice1
Copy link
Member

Yeah, I did note that "Achievements Leaderboard" does become the longest name in the site navigation. But it seems to still fit okay.

@somiaj somiaj force-pushed the achievement-leader-board branch from 95843d5 to 1ce79e9 Compare November 14, 2024 02:47
@somiaj
Copy link
Contributor Author

somiaj commented Nov 14, 2024

@drgrice1 thanks again, your suggestions improve load speed quite a bit here. Still takes a couple of seconds, but 3 seconds is faster than the 15 or so seconds I was getting.

@somiaj somiaj force-pushed the achievement-leader-board branch from 1ce79e9 to 30586c1 Compare November 23, 2024 01:43
This adds a leaderboard for achievements, which ranks users from the
greatest to the least number of achievement points along with showing
the badges of all earned achievements.

The default use of this is to provide a summary page for professors
to see how many achievement points students have earned along with
which badges they have earned. The default permission level to view
the leaderboard and see usernames on the leaderboard is professor.

The permission level for viewing the leaderboard and viewing names
on the leaderboard can be changed under course configuration to
allow students to see the leaderboard. It is noted that since
achievement points are often closely related to grades, that this
should be considered before allowing students access.
Rename "Leaderboard" to "AchievementsLeaderboard".

Implement the code and database improvements to make the page load faster.
@somiaj somiaj force-pushed the achievement-leader-board branch from 30586c1 to 3ad85d9 Compare December 10, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants