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

Prefix all constants with DMOJ_ #930

Merged
merged 1 commit into from
Apr 2, 2019
Merged

Prefix all constants with DMOJ_ #930

merged 1 commit into from
Apr 2, 2019

Conversation

kiritofeng
Copy link
Member

New naming convention for constants is DMOJ_MODULE_<NAME>, as decided in Slack.

.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()
Copy link
Member

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?

Copy link
Member

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)
Copy link
Member

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()
Copy link
Member

Choose a reason for hiding this comment

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

SyntaxError

.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()
Copy link
Member

Choose a reason for hiding this comment

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

It is.

@quantum5
Copy link
Member

Also provide a list of changes, and preferably, a sed or perl script to edit local_settings.py.

@quantum5
Copy link
Member

This doesn't look broken, but given that past changes have syntax errors, I would like to see this code being run.

@quantum5
Copy link
Member

quantum5 commented Apr 1, 2019

Still need a local_settings.py update script.

@kiritofeng
Copy link
Member Author

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) \
Copy link
Member

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 )?

@quantum5 quantum5 merged commit 48f4cab into master Apr 2, 2019
kiritofeng added a commit that referenced this pull request Apr 3, 2019
quantum5 pushed a commit that referenced this pull request Apr 3, 2019
Ninjaclasher pushed a commit to mcpt/wlmoj that referenced this pull request Apr 3, 2019
Ninjaclasher pushed a commit to mcpt/wlmoj that referenced this pull request Apr 3, 2019
Ninjaclasher pushed a commit to mcpt/wlmoj that referenced this pull request Apr 14, 2019
@quantum5 quantum5 deleted the constants branch April 23, 2019 02:04
gozzarda added a commit to uwapcs/pcs-org-au-dmoj that referenced this pull request Aug 27, 2019
malbareda pushed a commit to malbareda/JOEL-web that referenced this pull request Jan 4, 2024
Changed constants to follow new naming convention for constants,
`DMOJ_MODULE_<NAME>`, as decided in Slack.
malbareda pushed a commit to malbareda/JOEL-web that referenced this pull request Jan 4, 2024
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.

3 participants