Closed trouni closed 1 year ago
@dmbf29 Don't pay attention to the long commit history, I didn't branch out from the most recent main... Only the last 2 commits are relevant to this PR.
Also noticed a review question doesn't get pinged in our Slack ☝️
takes 3 minutes to create memberships for every competition 🤔 should take seconds...
takes 3 minutes to create memberships for every competition 🤔 should take seconds...
Yeah I know what's happening. I noticed as well that updating predictions is taking longer than usual, because the views are being refreshed after we create/update any of those records.
I will move the refreshing to an asynchronous job to speed things up, and will try to prevent the callback from triggering in the seeds.
Yeah that's an issue with the FE, it happens sometimes, I need to look into it. Unrelated to this BE feature though.
I've updated the PR. Can you try again? Maybe test the scraping/API jobs as well just in case?
Btw, the diff looks scary, but I just wrapped some of the actions in a block to prevent the callback from triggering...
DatabaseViews.run_without_callback(then_refresh: true) do
# Do something
end
Changes in this PR
Modifications to the Leaderboard model
Four attributes have been added to the Leaderboard model:
description
(could be used by the FE)auto_join
(whether or not to join the leaderboard upon signup)leave_disabled
(disable the leave option)rankings_top_n
(limit the number of users returned for the leaderboard to the top n)Refactoring of seeds
The seeds have been refactored in order to allow using multiple seeds files inside the
db/seeds
folder.rake db:seed
will run all the files inside thedb/seeds
folder. Since the order of execution matters, I have moved the content of the previousseeds.rb
file into a0_default.rb
file, but we could also split this into separate files in the future.In order to seed the global leaderboard, we should run this rake task:
Remaining tasks
Some changes still need to be made in the FE:
leave_disabled
flag istrue
(Fixed in trouni/predictor-vue#234)Related issues
Fixes #107, fixes trouni/predictor-vue#215