-
Notifications
You must be signed in to change notification settings - Fork 365
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
Prefix all constants with DMOJ_ #930
Conversation
judge/models/profile.py
Outdated
.annotate(max_points=Max('submission__points')).order_by('-max_points') | ||
.values_list('max_points', flat=True).filter(max_points__gt=0)) | ||
extradata = Problem.objects.filter(submission__user=self, submission__result='AC', is_public=True).values('id') | ||
.distinct().count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a syntax error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is.
table = (lambda x: [pow(x, i) for i in xrange(100)])(getattr(settings, 'PP_STEP', 0.95)) | ||
bonus_function = getattr(settings, 'PP_BONUS_FUNCTION', lambda n: 300 * (1 - 0.997 ** n)) | ||
_pp_step = getattr(settings, 'DMOJ_PP_STEP', 0.95) | ||
table = (lambda x: [pow(x, i) for i in xrange(getattr(settings, 'DMOJ_PP_ENTRIES', 100))])(_pp_step) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we still need this lambda
? It only existed in the old code because whoever wrote it does not want to have a variable.
for row in Profile.objects.all(): | ||
data = (Problem.objects.filter(submission__user=row, submission__points__isnull=False, is_public=True) | ||
.annotate(max_points=Max('submission__points')).order_by('-max_points') | ||
.values_list('max_points', flat=True)) | ||
extradata = Problem.objects.filter(submission__user=row, submission__result='AC', is_public=True).values('id').distinct().count() | ||
extradata = Problem.objects.filter(submission__user=row, submission__result='AC', is_public=True).values('id') | ||
.distinct().count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SyntaxError
judge/models/profile.py
Outdated
.annotate(max_points=Max('submission__points')).order_by('-max_points') | ||
.values_list('max_points', flat=True).filter(max_points__gt=0)) | ||
extradata = Problem.objects.filter(submission__user=self, submission__result='AC', is_public=True).values('id') | ||
.distinct().count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is.
Also provide a list of changes, and preferably, a |
This doesn't look broken, but given that past changes have syntax errors, I would like to see this code being run. |
Still need a |
judge/models/profile.py
Outdated
extradata = Problem.objects.filter(submission__user=self, submission__result='AC', is_public=True).values('id').distinct().count() | ||
bonus_function = getattr(settings, 'PP_BONUS_FUNCTION', lambda n: 300 * (1 - 0.997 ** n)) | ||
data = (Problem.objects.filter(submission__user=self, submission__points__isnull=False, is_public=True, | ||
is_organization_private=False) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using \
when between (
and )
?
Changed constants to follow new naming convention for constants, `DMOJ_MODULE_<NAME>`, as decided in Slack.
New naming convention for constants is
DMOJ_MODULE_<NAME>
, as decided in Slack.