Closed Cena-Studio closed 2 months ago
Fixed the issue that the ranking bar is not rendered with correct length.
I've just made a commit with some backend changes. They're quite minor, but I'll summarise them here and you can check the commit for the exact lines changed.
/leaderboard/:sort_column
route has been removed, since it only existed for the purpose of the old sorting method which is deprecated alongside this PR.Report
from the branch I'm working on because I think it's useful here. Report#pretty_owner
will return a string representing the username of the user who owns that report. The difference between this and simple retrieving username
is that pretty_owner
will return "Anonymous"
if the report was sent without a user. The current leaderboard was showing null
in these cases which we should avoid showing to users.report
table. While it's possible to use (e.g.) report[:ram_units]
or report.ram_units
to access the same field, the latter is more conventional in Rails. Functionally there is a difference too - if you made a typo and tried to call report[:rm_uits]
then you'll get nil
as a response, whereas report.rm_uits
will raise an error stating that the field doesn't exist.
Overview
This PR mainly implements the default leaderboard. It also made some adjustments to previous styles
Major Changes
Front End
app/views/report/index.html.erb
is changed.app/assets/stylesheets/leaderboard.css
andapp/javascript/report/index.js
are added to provide logics/styles for the leaderboard page.turbo-rails
andcontrollers
have been disabled since they caused some unknown bugs.Back End
raw_data
is roughly implemented to respond with the minimum required JSON data for the default leaderboard.Minor Changes
#586674
for the navibar looks better than#404040
in most cases, it is now defined as the default font color.Testing
rails s
.app/javascript/report/index.js
.localhost:3000/leaderboards
. A new record should be added to the leaderboard each time the webpage is refreshed until the uncommented lines are disabled again.localhost:3000/leaderboards
to see the result.