Skip to content

Commit

Permalink
Fix #2279: get associated ContestProblem with Clarification entity
Browse files Browse the repository at this point in the history
(cherry picked from commit affacb4)
  • Loading branch information
moesoha authored and cubercsl committed Aug 3, 2024
1 parent 8f28862 commit b00a8ec
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions webapp/src/Entity/Clarification.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ public function getProblem(): ?Problem
return $this->problem;
}

public function getContestProblem(): ?ContestProblem
{
if (!$this->problem) {
return null;
}
return $this->contest->getContestProblem($this->problem);
}

/**
* @Serializer\VirtualProperty()
* @Serializer\SerializedName("problem_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

<td><a href="{{ link }}">
{%- if clarification.problem -%}
problem {{ clarification.problem.contestProblems.first | problemBadge -}}
problem {{ clarification.contestProblem | problemBadge -}}
{%- elseif clarification.category -%}
{{- categories[clarification.category]|default('general') -}}
{%- else -%}
Expand Down
2 changes: 1 addition & 1 deletion webapp/templates/team/partials/clarification.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col-sm">
Subject:
{% if clarification.problem %}
Problem {{ clarification.problem.contestProblems.first.shortname }}: {{ clarification.problem.name }}
Problem {{ clarification.contestProblem.shortname }}: {{ clarification.problem.name }}
{% elseif clarification.category %}
{{ categories[clarification.category]|default('general') }}
{% else %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<td>
<a data-ajax-modal data-ajax-modal-after="markSeen" href="{{ link }}">
{%- if clarification.problem -%}
problem {{ clarification.problem.contestProblems.first | problemBadge -}}
problem {{ clarification.contestProblem | problemBadge -}}
{%- elseif clarification.category -%}
{{- categories[clarification.category]|default('general') -}}
{%- else -%}
Expand Down

0 comments on commit b00a8ec

Please sign in to comment.