Skip to content

Conversation

@lsabor
Copy link
Contributor

@lsabor lsabor commented Dec 14, 2025

closes #3808

This task will take ~20 minutes long, so it might be worth considering optimizing the approach.
The only thing that takes a long time is the head to head scoring for popular questions. The simplest solution would be to store all of the head to head scores at question resolution in a new table. This would take the task down to 1-2 minutes from upwards of 30 (and maybe some memory issues).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that happens here is to factor out the handle action so it can be called with a task

@lsabor lsabor requested a review from hlbmtc December 14, 2025 20:10
bootstrap_iterations = 30

# SETUP: users to evaluate & questions
print("Initializing...")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prints won't be typically visible in django command handlers, so I suggest using logging instead

Comment on lines +614 to +616
metadata__bot_details__metac_bot=True,
metadata__bot_details__include_in_calculations=True,
metadata__bot_details__display_in_leaderboard=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this might be a slow operation since we don't index User.metadata col

Comment on lines +631 to +637
related_posts__post__default_project_id__in=[
3349, # aib q3 2024
32506, # aib q4 2024
32627, # aib q1 2025
32721, # aib q2 2025
32813, # aib fall 2025
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to refactor this so we don’t hardcode these values here?
At the very least, I’d move these IDs into constants.py.

Score.objects.filter(user=user, question__in=question_list)
.distinct("question_id")
.count()
.exclude(related_posts__post__default_project__slug__startswith="minibench")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned here, I don't like this slug approach

#3925 (comment)

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

Successfully merging this pull request may close these issues.

Global Bot Leaderboard - daily updating

3 participants