Skip to content

Commit cc10d3c

Browse files
committed
Rebrush test result view for RfCs and external user statistics
1 parent fb5b4ef commit cc10d3c

File tree

8 files changed

+32
-48
lines changed

8 files changed

+32
-48
lines changed

app/assets/stylesheets/request-for-comments.css.scss

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -57,48 +57,13 @@
5757
.testrun-assess-results {
5858

5959
.testrun-container {
60-
display: flex;
6160
margin-bottom: 10px;
6261

6362
.testrun-output {
6463
overflow-x: auto;
6564
flex-grow: 1;
6665
}
6766
}
68-
69-
.result {
70-
margin-right: 10px;
71-
margin-top: 20px;
72-
min-width: 10px;
73-
max-width: 10px;
74-
min-height: 10px;
75-
max-height: 10px;
76-
}
77-
78-
.passed {
79-
border-radius: 50%;
80-
background-color: var(--bs-success);
81-
-webkit-box-shadow: 0 0 11px 1px rgba(var(--bs-success-rgb), 1);
82-
-moz-box-shadow: 0 0 11px 1px rgba(var(--bs-success-rgb), 1);
83-
box-shadow: 0 0 11px 1px rgba(var(--bs-success-rgb), 1);
84-
}
85-
86-
.unknown {
87-
border-radius: 50%;
88-
background-color: var(--bs-warning);
89-
-webkit-box-shadow: 0 0 11px 1px rgba(var(--bs-warning-rgb), 1);
90-
-moz-box-shadow: 0 0 11px 1px rgba(var(--bs-warning-rgb), 1);
91-
box-shadow: 0 0 11px 1px rgba(var(--bs-warning-rgb), 1);
92-
}
93-
94-
.failed {
95-
border-radius: 50%;
96-
background-color: var(--bs-danger);
97-
-webkit-box-shadow: 0 0 11px 1px rgba(var(--bs-danger-rgb), 1);
98-
-moz-box-shadow: 0 0 11px 1px rgba(var(--bs-danger-rgb), 1);
99-
box-shadow: 0 0 11px 1px rgba(var(--bs-danger-rgb), 1);
100-
}
101-
10267
}
10368

10469
#mark-as-solved-button {

app/assets/stylesheets/statistics.css.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
margin-bottom: auto;
2828
}
2929

30-
div.unit-test-result {
30+
div.deadline-result {
3131
float: left;
3232
margin-right: 10px;
3333
width: 10px;

app/views/exercises/external_users/statistics.html.slim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@ h1
7474
td = this.cause
7575
td = this.score
7676
td.align-middle
77-
-this.testruns.sort_by {|t| [t.file&.name ? 0 : 1, t.file&.name] }.each do |run|
78-
- if run.passed
79-
.unit-test-result.positive-result title=[run.file&.filepath, run.log].join("\n").strip
77+
- this.testruns.sort_by {|t| [t.file&.filepath ? 0 : 1, t.file&.filepath] }.each do |run|
78+
- if run.passed.nil? # run
79+
span.text-warning
80+
i.fa-solid.fa-circle-play.me-2 aria-hidden='true' title=[run.file&.filepath, run.log].join("\n").strip
81+
- elsif run.passed
82+
span.text-success
83+
i.fa-solid.fa-circle-check.me-2 aria-hidden='true' title=[run.file&.filepath, run.log].join("\n").strip
8084
- else
81-
.unit-test-result.unknown-result title=[run.file&.filepath, run.log].join("\n").strip
85+
span.text-danger
86+
i.fa-solid.fa-circle-xmark.me-2 aria-hidden='true' title=[run.file&.filepath, run.log].join("\n").strip
8287
td = @working_times_until[event_index] if policy(@exercise).detailed_statistics?
8388
- elsif this.is_a? UserExerciseIntervention
8489
td = this.created_at.strftime('%F %T')

app/views/exercises/statistics.html.slim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ h1 = @exercise
8181
- latest_user_submission = submissions.where(contributor:).final.latest
8282
- if latest_user_submission.present?
8383
- if latest_user_submission.before_deadline?
84-
.unit-test-result.positive-result
84+
.deadline-result.positive-result
8585
- elsif latest_user_submission.within_grace_period?
86-
.unit-test-result.unknown-result
86+
.deadline-result.unknown-result
8787
- elsif latest_user_submission.after_late_deadline?
88-
.unit-test-result.negative-result
88+
.deadline-result.negative-result
8989
td = us['runs'] if policy(@exercise).detailed_statistics?
9090
td = @exercise.average_working_time_for(contributor) || 0 if policy(@exercise).detailed_statistics?

app/views/external_users/statistics.html.slim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ h1 = t('.title', user: @user.displayname)
2626
- latest_viewable_submission = submissions.where(exercise:).final.latest
2727
- if latest_viewable_submission.present?
2828
- if latest_viewable_submission.before_deadline?
29-
.unit-test-result.positive-result.before_deadline
29+
.deadline-result.positive-result.before_deadline
3030
- elsif latest_viewable_submission.within_grace_period?
31-
.unit-test-result.unknown-result.within_grace_period
31+
.deadline-result.unknown-result.within_grace_period
3232
- elsif latest_viewable_submission.after_late_deadline?
33-
.unit-test-result.negative-result.after_late_deadline
33+
.deadline-result.negative-result.after_late_deadline
3434
td = stats['runs'] || 0 if policy(exercises.first).detailed_statistics?
3535
td = stats['working_time'] || 0 if policy(exercises.first).detailed_statistics?
3636
- else

app/views/request_for_comments/show.html.slim

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,25 @@
4242
- output_runs.each do |testrun|
4343
pre = testrun.log || t('request_for_comments.no_output')
4444

45-
- assess_runs = testruns.select {|run| run.cause == 'assess' }
45+
- assess_runs = testruns.select {|run| run.cause == 'assess' }.sort_by {|run| [run.file&.filepath ? 0 : 1, run.file&.filepath]}
4646
- unless current_user.admin?
4747
- assess_runs = assess_runs.select {|run| run.file.present? ? !run.file.hidden_feedback? : true }
4848
- if assess_runs.size.positive?
4949
h5.mt-4 = t('request_for_comments.test_results')
5050
.testrun-assess-results
5151
- assess_runs.each do |testrun|
5252
.testrun-container
53-
div class="result #{testrun.passed ? 'passed' : 'failed'}"
53+
.d-flex.justify-content-between
54+
h6
55+
- if testrun.passed
56+
span.text-success
57+
i.fa-solid.fa-circle-check.me-2 aria-hidden='true'
58+
=> t('request_for_comments.passed') + ':'
59+
- else
60+
span.text-danger
61+
i.fa-solid.fa-circle-xmark.me-2 aria-hidden='true'
62+
=> t('request_for_comments.failed') + ':'
63+
= testrun.file.filepath
5464
.collapsed.testrun-output.text
5565
span.fa-solid.fa-chevron-down.collapse-button
5666
pre = testrun.log || t('request_for_comments.no_output')

config/locales/de/request_for_comment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ de:
2121
click_here: Zum Kommentieren auf die Seitenleiste klicken!
2222
comment_edited: bearbeitet
2323
comments: Kommentare
24+
failed: Fehlgeschlagen
2425
howto: |
2526
Um Kommentare zu einer Programmzeile hinzuzufügen, kann einfach auf die jeweilige Zeilennummer auf der linken Seite geklickt werden. <br>
2627
Es öffnet sich ein Textfeld, in dem der Kommentar eingetragen werden kann. <br>
@@ -40,6 +41,7 @@ de:
4041
modal_title: Einen Kommentar in Zeile %{line} hinzufügen
4142
no_output: Keine Ausgabe.
4243
no_question: Der/die Autor:in hat keine Frage zu dieser Anfrage gestellt.
44+
passed: Erfolgreich
4345
runtime_output: Programmausgabe
4446
send_thank_you_note: Senden
4547
show_all: Alle Anfragen anzeigen

config/locales/en/request_for_comment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ en:
2121
click_here: Click on this sidebar to comment!
2222
comment_edited: edited
2323
comments: Comments
24+
failed: Failed
2425
howto: |
2526
To leave comments to a specific code line, click on the respective line number. <br>
2627
Enter your comment in the popup and save it by clicking "Comment this". <br>
@@ -40,6 +41,7 @@ en:
4041
modal_title: Add a comment to line %{line}
4142
no_output: No output.
4243
no_question: The author did not enter a question for this request.
44+
passed: Passed
4345
runtime_output: Runtime Output
4446
send_thank_you_note: Send
4547
show_all: All requests

0 commit comments

Comments
 (0)