示例#1
0
文件: atcoder.py 项目: luobuccc/site
 def display_user_problem(self, participation, contest_problem):
     format_data = (participation.format_data
                    or {}).get(str(contest_problem.id))
     if format_data:
         penalty = format_html(
             '<small style="color:red"> ({penalty})</small>',
             penalty=floatformat(
                 format_data['penalty'])) if format_data['penalty'] else ''
         return format_html(
             '<td class="{state}"><a href="{url}">{points}{penalty}<div class="solving-time">{time}</div></a></td>',
             state=(('pretest-' if self.contest.run_pretests_only
                     and contest_problem.is_pretested else '') +
                    self.best_solution_state(format_data['points'],
                                             contest_problem.points)),
             url=reverse('contest_user_submissions',
                         args=[
                             self.contest.key,
                             participation.user.user.username,
                             contest_problem.problem.code
                         ]),
             points=floatformat(format_data['points']),
             penalty=penalty,
             time=nice_repr(timedelta(seconds=format_data['time']),
                            'noday'),
         )
     else:
         return mark_safe('<td></td>')
示例#2
0
 def display_participation_result(self, participation):
     return format_html(
         '<td class="user-points">{points}<div class="solving-time">{cumtime}</div></td>',
         points=floatformat(participation.score),
         cumtime=nice_repr(timedelta(seconds=participation.cumtime),
                           'noday') if self.config['cumtime'] else '',
     )
示例#3
0
文件: bonuses.py 项目: FlatPaper/site
    def display_user_problem(self, participation, contest_problem):
        format_data = (participation.format_data
                       or {}).get(str(contest_problem.id))
        if format_data:
            pretest = ('pretest-' if contest_problem.is_pretested else '')
            first_solve = (' first-solve'
                           if format_data['first_solve'] else '')
            bonus = format_html(
                u'<font style="font-size:10px;"> +{bonus}</font>',
                bonus=floatformat(
                    format_data['bonus'])) if format_data['bonus'] else ''

            return format_html(
                u'<td class="{state}"><a href="{url}">{points}{bonus}<div class="solving-time">{time}</div></a></td>',
                state=pretest + self.best_solution_state(
                    format_data['points'], contest_problem.points) +
                first_solve,
                url=reverse('contest_user_submissions',
                            args=[
                                self.contest.key,
                                participation.user.user.username,
                                contest_problem.problem.code
                            ]),
                points=floatformat(format_data['points']),
                bonus=bonus,
                time=nice_repr(timedelta(seconds=format_data['time']),
                               'noday'),
            )
        else:
            return mark_safe('<td></td>')
示例#4
0
 def display_participation_result(self, participation):
     return format_html(
         '<td class="user-points"><a href="{url}">{points}<div class="solving-time">{cumtime}</div></a></td>',
         url=reverse('contest_all_user_submissions',
                     args=[self.contest.key, participation.user.user.username]),
         points=floatformat(participation.score, -self.contest.points_precision),
         cumtime=nice_repr(timedelta(seconds=participation.cumtime), 'noday') if self.config['cumtime'] else '',
     )
示例#5
0
 def display_participation_result(self, participation):
     return format_html(
         u'<td class="user-points">{points}<div class="solving-time">{cumtime}</div></td>',
         points=floatformat(participation.score,
                            -self.contest.points_precision),
         cumtime=nice_repr(timedelta(seconds=participation.cumtime),
                           'noday'),
     )
示例#6
0
    def display_participation_result(self, participation, is_scoreboard_frozen):
        cumtime = participation.frozen_cumtime if is_scoreboard_frozen else participation.cumtime
        score = participation.frozen_score if is_scoreboard_frozen else participation.score

        return format_html(
            u'<td class="user-points">{points}<div class="solving-time">{cumtime}</div></td>',
            points=floatformat(score),
            cumtime=nice_repr(timedelta(seconds=cumtime), 'noday'),
        )
示例#7
0
文件: default.py 项目: DMOJ/site
 def display_user_problem(self, participation, contest_problem):
     format_data = (participation.format_data or {}).get(str(contest_problem.id))
     if format_data:
         return format_html(
             u'<td class="{state}"><a href="{url}">{points}<div class="solving-time">{time}</div></a></td>',
             state=('pretest-' if self.contest.run_pretests_only and contest_problem.is_pretested else '') +
                   self.best_solution_state(format_data['points'], contest_problem.points),
             url=reverse('contest_user_submissions',
                         args=[self.contest.key, participation.user.user.username, contest_problem.problem.code]),
             points=floatformat(format_data['points']),
             time=nice_repr(timedelta(seconds=format_data['time']), 'noday'),
         )
     else:
         return mark_safe('<td></td>')
示例#8
0
    def display_user_problem(self, participation, contest_problem, is_scoreboard_frozen):
        if is_scoreboard_frozen:
            format_data = (participation.frozen_format_data or {}).get(str(contest_problem.id))
        else:
            format_data = (participation.format_data or {}).get(str(contest_problem.id))

        if format_data:
            if format_data['points'] == 0:
                penalty = ''
            else:
                penalty = format_html('<small style="color:red"> ({penalty})</small>',
                                    penalty=floatformat(format_data['penalty'])) if format_data['penalty'] > 0 else ''

            return format_html(
                u'<td class="{state}">{points}{penalty}<div class="solving-time">{time}</div></td>',
                state=('pretest-' if self.contest.run_pretests_only and contest_problem.is_pretested else '') +
                      self.best_solution_state(format_data['points'], contest_problem.points),
                points=floatformat(format_data['points']),
                penalty=penalty,
                time=nice_repr(timedelta(seconds=format_data['time']), 'noday'),
            )
        else:
            return mark_safe('<td></td>')
示例#9
0
文件: default.py 项目: DMOJ/site
 def display_participation_result(self, participation):
     return format_html(
         u'<td class="user-points">{points}<div class="solving-time">{cumtime}</div></td>',
         points=floatformat(participation.score),
         cumtime=nice_repr(timedelta(seconds=participation.cumtime), 'noday'),
     )
示例#10
0
def timedelta(value, display='long'):
    if value is None:
        return value
    return nice_repr(value, display)
示例#11
0
文件: timedelta.py 项目: DMOJ/site
def timedelta(value, display='long'):
    if value is None:
        return value
    return nice_repr(value, display)