Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tle/cogs/codeforces.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
_GITGUD_NO_SKIP_TIME = 3 * 60 * 60
_GITGUD_SCORE_DISTRIB = (2, 3, 5, 8, 12, 17, 23)
_GITGUD_MAX_ABS_DELTA_VALUE = 300
#Minimum rating so that beginners can solve 800-1300 problems. Can change(maybe) to 1100, so they can solve 800-1400. No problem on codeforces with <800 rating
_GITGUD_MIN_RATING = 1000


class CodeforcesCogError(commands.CommandError):
Expand Down Expand Up @@ -71,6 +73,8 @@ async def upsolve(self, ctx, choice: int = -1):
handle, = await cf_common.resolve_handles(ctx, self.converter, ('!' + str(ctx.author),))
user = cf_common.user_db.fetch_cf_user(handle)
rating = round(user.effective_rating, -2)
#minimum rating so that beginners can solve problems
rating = max(rating, _GITGUD_MIN_RATING)
resp = await cf.user.rating(handle=handle)
contests = {change.contestId for change in resp}
submissions = await cf.user.status(handle=handle)
Expand Down Expand Up @@ -225,6 +229,8 @@ async def gitgud(self, ctx, delta: int = 0):
handle, = await cf_common.resolve_handles(ctx, self.converter, ('!' + str(ctx.author),))
user = cf_common.user_db.fetch_cf_user(handle)
rating = round(user.effective_rating, -2)
#minimum rating so that beginners can solve problems
rating = max(rating, _GITGUD_MIN_RATING)
submissions = await cf.user.status(handle=handle)
solved = {sub.problem.name for sub in submissions}
noguds = cf_common.user_db.get_noguds(ctx.message.author.id)
Expand Down