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

Create a refresh function #8

Closed
vbonvin opened this issue Nov 20, 2016 · 3 comments
Closed

Create a refresh function #8

vbonvin opened this issue Nov 20, 2016 · 3 comments
Assignees

Comments

@vbonvin
Copy link
Member

vbonvin commented Nov 20, 2016

Currently, pages refreshes only when someone wants to access them, and after a given minimum amount of time (otherwise the cache version is displayed). It is in practice a good thing, but when too many people try to access a cpu-costly page at the same time, the server receives too much requests and crashes.

We need to change this. We need a refresh function that can be called e.g. through the admin panel by pressing a button, and where every pages refresh. When participants access the web site, they only see the pages that are in the cache.

@xuod
Copy link
Collaborator

xuod commented Jan 16, 2017

I added an update_points function that receives the post_save signal from Round : when a round is saved, eg from the admin panel, it triggers this function that computes points for participants and teams (which were added a field points_so_far). Then all views should use this db field. That's a progress, but it's not perfect yet (some views still need to compute some scores).

@mhrz
Copy link
Collaborator

mhrz commented Jan 21, 2017

@xuod Could you please explain your improvement of yesterday?

@xuod
Copy link
Collaborator

xuod commented Jan 21, 2017

Some detail to the optimization :

  • Round model now does the computation of its scores (I call score the averaged grades of the jury for one round) and points (=scores * coefficients) when it is saved (I overrode the save function).
  • Team, Participant and Problem models each have an update_scores function too that computes the total points and/or the mean scores in for each role (see Points/average grade #19 ) and save those to the database.
  • in admin.py, I override the save and save_related functions, so that when a round is saved from the admin, it will :
  1. save the rejections and the jury grades in the database
  2. call Round.update_scores
  3. call Team.update_scores for the teams participating in the round
  4. each of these call Participant.update_scores for its participants
  5. call Problem.update_scores

@xuod xuod mentioned this issue Jan 21, 2017
@mhrz mhrz closed this as completed Apr 3, 2018
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

No branches or pull requests

3 participants