Optimization `PR#2` - Submissions and Participants Count
@ mention of reviewers`
@Didayolo`
A brief description of the purpose of the changes contained in this PR.
This is a first PR in the optimization effort to load codabench quickly. The following are done in this PR:
- Adde new fields to competition modal
participants_count
andsubmissions_count
- Used these fields in the competition detail page
- Used
participants_count
field in public competitions page - Used
participants_count
field in the popular competitions section in home page
On the backend, serializers are changed to use this new filed instead of the annotated values from the queries.
NOTE
- when you upload a new submission,
submissions_count
will be updated (+1) - When you delete a submission,
submissions_count
will be updated (-1) - When a new participant joins the competition (even not approved yet) the
participants_count
will update (+1) -
participants_count
is never decremented because we do not delete a participant we only revoke the status
Manual update
1. Migration
docker compose exec django ./manage.py migrate
2. Update counts for all competitions
Bash into django console
docker compose exec django ./manage.py shell_plus
Import and call the function
from competitions.submission_participant_counts import compute_submissions_participants_counts
compute_submissions_participants_counts()
Issues this PR resolves
-
#1327 ->
Submissions and Participants
Checklist
-
Code review by me -
Hand tested by me -
I'm proud of my work -
Code review by reviewer -
Hand tested by reviewer -
CircleCi tests are passing -
Ready to merge