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>')
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 '', )
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>')
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 '', )
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'), )
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'), )
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>')
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>')
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'), )
def timedelta(value, display='long'): if value is None: return value return nice_repr(value, display)