-
Notifications
You must be signed in to change notification settings - Fork 95
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
Dynamic Course Configurable EC calculation #584
Conversation
Oh yeah.. and I also made DiscordUser IDs numbers.. because they are. |
Couple things I realized this morning I need to address before merging.
|
I have no authority to approve this, but LGTM other than that one apparent typo for the thanks leaderboard calc!
Agree with the first 3 of these. Although I'm not sure what purpose the last point has? AFAICT, all discord message ids are unique, even between channels, so being unique on just |
From the Discord API docs
You're probably correct that just being distinct on |
@ConnorNelson any thoughts? I'd like merge this in late tonight. |
@@ -24,6 +25,17 @@ def get_letter_grade(dojo, grade): | |||
return letter_grade | |||
return "?" | |||
|
|||
def clamp_ec(limit): | |||
global_limit = [limit] |
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.
Am I confused? Why is this a list?
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 is some insane python thing with the decorator instance holding the limiting value across functions. If it is not a list the value isn't captured in the decorator.
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 is how scoping works inside python, what you're looking for is the nonlocal
keyword.
I believe this is what you are trying to express:
def clamp_ec(limit):
def decorator(func):
def wrapper(*args, **kwargs):
nonlocal limit
result = func(*args, **kwargs)
clamped_result = min(result, limit)
limit -= clamped_result
return clamped_result
return wrapper
return decorator
YOLO |
Note: This PR is coupled with the corresponding sensai changes which use the added API endpoints.
API changes
DB changes
start_date
to Dojo object, which currently returns first earliest visible module as a proxy for course startCourse Grades page Changes
helpfulness
andmemes
max_credit
propertyhelpfulness
has a functionally requiredmethod
property identifying the calculation method to use1337log2
uses1.337 ** log2(thanks) / 100
with a hard cap ofmax_credit
if setlog50
uses log50 approaching themax_credit
valueec_limit
dojo.start_date
(described above) tostart_date
+ 16 weeksI believe this setup is sufficient to represent all currently live ASU EC scenarios based on course syllabus.