File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525from future .builtins .disabled import * # noqa
2626from future .builtins import * # noqa
2727from six import itervalues , iteritems
28+ from six .moves import zip_longest
2829
2930import heapq
3031import 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
3537logger = 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 )
You can’t perform that action at this time.
0 commit comments