Skip to content

Commit

Permalink
Improve problem result page
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Mar 22, 2024
1 parent dd63c20 commit d242901
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 10 additions & 5 deletions server/frontend/pages/problem_result.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,26 @@ <h2>Problem Submission</h2>
</time>
</strong>
before you can submit another answer.
<a href="/problems/{{ .Day }}">Go back to the problem here</a>.
</p>
<p><a href="/problems/{{ .Day }}">Go back to the problem here</a>.</p>
{{ else }}
{{ if .Correct }}
<p>
Congratulations, your answer is <strong>correct</strong>! Solving this problem nets you a
total of <b>{{ .PointsAwarded | floor }} points</b>.
{{ if eq .Part 1 }}
You're halfway there! You can now submit the answer to the second part of the problem.
{{ else }}
You've completed all 2 parts of the problem. Congratulations!
{{ end }}
</p>
<p>
<a href="/problems/{{ .Day }}">Go back to the problem here</a>, or
<a href="/leaderboard">check out the leaderboard</a>.
</p>
{{ else }}
<p>
Sorry, your answer is <strong>incorrect</strong>.
<a href="/problems/{{ .Day }}">Go back to the problem here</a>.
</p>
<p>Sorry, your answer is <strong>incorrect</strong>.</p>
<p><a href="/problems/{{ .Day }}">Go back to the problem here</a>.</p>
{{ end }}
{{ end }}
</article>
Expand Down
2 changes: 2 additions & 0 deletions server/r_problems.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (s *Server) viewProblemInput(w http.ResponseWriter, r *http.Request) {
type problemResultPageData struct {
frontend.ComponentContext
Day problemDay
Part int
Cooldown time.Duration
CooldownTime time.Time
Correct bool
Expand Down Expand Up @@ -254,6 +255,7 @@ func (s *Server) submitProblem(w http.ResponseWriter, r *http.Request) {
Username: u.Username,
},
Day: day,
Part: data.Part,
Correct: correct,
Cooldown: cooldown,
CooldownTime: cooldownTime,
Expand Down

0 comments on commit d242901

Please sign in to comment.