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

Result percentage changed to a fraction #332

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Changed how max_score is calculated
  • Loading branch information
SZonkil committed Mar 19, 2024
commit c3e71cadaca3f09d37ca1ae59d80ffe96db8ba3e
5 changes: 3 additions & 2 deletions oioioi/programs/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os.path
from fractions import Fraction
from math import ceil
from operator import itemgetter # pylint: disable=E0611

Expand Down Expand Up @@ -99,7 +100,7 @@ def min_group_scorer(test_results):
def discrete_test_scorer(test, result):
status = result['result_code']
percentage = result.get('result_percentage', (100, 1))
max_score = int(ceil(percentage[0] * test['max_score'] / (100. * percentage[1])))
max_score = ceil(Fraction(*percentage) * test['max_score'])
score = max_score if status == 'OK' else 0
return IntegerScore(score), IntegerScore(test['max_score']), status

Expand All @@ -110,7 +111,7 @@ def threshold_linear_test_scorer(test, result):
used = result.get('time_used', 0)
status = result['result_code']
percentage = result.get('result_percentage', (100, 1))
max_score = int(ceil(percentage[0] * test['max_score'] / (100. * percentage[1])))
max_score = ceil(Fraction(*percentage) * test['max_score'])
test_max_score = IntegerScore(test['max_score'])

if status != 'OK':
Expand Down
Loading