forked from JOJ/Joint-Teapot
fix: penalty factor calculation
This commit is contained in:
parent
54a4f404fe
commit
beeb45709f
|
@ -330,7 +330,7 @@ class Teapot:
|
|||
f"[{end_time + timedelta(seconds=1)}, {penalty_end_time}].\n",
|
||||
True,
|
||||
)
|
||||
else:
|
||||
elif now > end_time:
|
||||
return (
|
||||
"### Submission Time Check Passed\n"
|
||||
f"Current time {now} is not in the valid range "
|
||||
|
|
|
@ -305,8 +305,10 @@ def get_penalty_factor(
|
|||
) -> float:
|
||||
if not end_time or not penalty_config:
|
||||
return 1.0
|
||||
penalties = parse_penalty_config(penalty_config)
|
||||
now = datetime.now()
|
||||
if now < end_time:
|
||||
return 1.0
|
||||
penalties = parse_penalty_config(penalty_config)
|
||||
res = 0.0
|
||||
for hour, factor in penalties[::-1]:
|
||||
if now < end_time + timedelta(hours=hour):
|
||||
|
|
Loading…
Reference in New Issue
Block a user