Skip to content

Commit 1ef3f1c

Browse files
Change RWS to handle new score mode subtask max
1 parent e324d25 commit 1ef3f1c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

cmsranking/Scoring.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
from future.builtins.disabled import * # noqa
2626
from future.builtins import * # noqa
2727
from six import itervalues, iteritems
28+
from six.moves import zip_longest
2829

2930
import heapq
3031
import logging
3132

32-
from cmscommon.constants import SCORE_MODE_MAX, SCORE_MODE_MAX_TOKENED_LAST
33+
from cmscommon.constants import \
34+
SCORE_MODE_MAX, SCORE_MODE_MAX_SUBTASK, SCORE_MODE_MAX_TOKENED_LAST
3335

3436

3537
logger = logging.getLogger(__name__)
@@ -124,6 +126,12 @@ def append_change(self, change):
124126
score = max([0.0] +
125127
[submission.score
126128
for submission in itervalues(self._submissions)])
129+
elif self._score_mode == SCORE_MODE_MAX_SUBTASK:
130+
scores_by_submission = (s.extra or []
131+
for s in itervalues(self._submissions))
132+
scores_by_subtask = zip_longest(*scores_by_submission,
133+
fillvalue=0.0)
134+
score = float(sum(max(s) for s in scores_by_subtask))
127135
elif self._score_mode == SCORE_MODE_MAX_TOKENED_LAST:
128136
score = max(self._released.query(),
129137
self._last.score if self._last is not None else 0.0)

0 commit comments

Comments
 (0)