VNOI-Admin / OJ

A modern open-source online judge and contest platform system.
https://oj.vnoi.info
GNU Affero General Public License v3.0
164 stars 73 forks source link

Calculate first solves/total AC in backend #305

Closed winprn closed 1 year ago

winprn commented 1 year ago

Description

Type of change: improvement

What

Move the calculation of first solves/total AC from client to server

Why

In ranking.html, firstSolve and totalAC loop through all elements in the ranking table and block the browser every time the ranking is refreshed, resulting in bad UX for contests with 1000+ users.

Now the calculation is moved to the server. The client no longer needs to process anything and renders much faster. In addition, the ranking table can be cached for all users, so the processing cost is paid only once.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.

hieplpvip commented 1 year ago

@leduythuccs Please take a look!

Unfortunately, servicing time for each request does increase. I did some basic optimizations to reduce the increase to ~0.1s.

This is probably the best we can get without pagination.