Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
aa00d8ac
Commit
aa00d8ac
authored
Mar 08, 2020
by
Robert Czechowski
Browse files
Add contest results csv download, add download link to contest results page (closes
#49
)
parent
3a1e7d35
Pipeline
#463
passed with stages
in 28 minutes and 5 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/core.rs
View file @
aa00d8ac
...
...
@@ -358,10 +358,10 @@ pub fn show_contest_results<T: MedalConnection>(conn: &T, contest_id: i32, sessi
let
(
tasknames
,
resultdata
)
=
conn
.get_contest_groups_grades
(
session
.id
,
contest_id
);
let
mut
results
:
Vec
<
(
String
,
i32
,
Vec
<
(
String
,
i32
,
Vec
<
String
>
)
>
)
>
=
Vec
::
new
();
let
mut
results
:
Vec
<
(
String
,
i32
,
Vec
<
(
String
,
String
,
i32
,
Vec
<
String
>
)
>
)
>
=
Vec
::
new
();
for
(
group
,
groupdata
)
in
resultdata
{
let
mut
groupresults
:
Vec
<
(
String
,
i32
,
Vec
<
String
>
)
>
=
Vec
::
new
();
let
mut
groupresults
:
Vec
<
(
String
,
String
,
i32
,
Vec
<
String
>
)
>
=
Vec
::
new
();
//TODO: use user
for
(
user
,
userdata
)
in
groupdata
{
...
...
@@ -381,9 +381,8 @@ pub fn show_contest_results<T: MedalConnection>(conn: &T, contest_id: i32, sessi
userresults
[
0
]
=
format!
(
"{}"
,
summe
);
groupresults
.push
((
format!
(
"{} {}"
,
user
.firstname
.unwrap_or_default
(),
user
.lastname
.unwrap_or_else
(||
"–"
.to_string
())),
groupresults
.push
((
user
.firstname
.unwrap_or_else
(||
"–"
.to_string
()),
user
.lastname
.unwrap_or_else
(||
"–"
.to_string
()),
user
.id
,
userresults
))
}
...
...
src/webfw_iron.rs
View file @
aa00d8ac
...
...
@@ -1071,7 +1071,7 @@ pub fn start_server<C>(conn: C, config: Config) -> iron::error::HttpResult<iron:
contestscurrent
:
get
"/contest/current/"
=>
currentcontests
::
<
C
>
,
contest
:
get
"/contest/:contestid"
=>
contest
::
<
C
>
,
contestresults
:
get
"/contest/:contestid/result/"
=>
contestresults
::
<
C
>
,
contestresults_download
:
get
"/contest/:contestid/download
/result
"
=>
contestresults_download
::
<
C
>
,
contestresults_download
:
get
"/contest/:contestid/
result/
download"
=>
contestresults_download
::
<
C
>
,
contest_post
:
post
"/contest/:contestid"
=>
contest_post
::
<
C
>
,
login
:
get
"/login"
=>
login
::
<
C
>
,
login_post
:
post
"/login"
=>
login_post
::
<
C
>
,
...
...
templates/default/contestresults_download.hbs
0 → 100644
View file @
aa00d8ac
Gruppe,Vorname,Nachname,Gesamtpunkte
{{#
each
taskname
}}
,
{{
this
}}{{/
each
}}
{{#
each
result
}}{{#
each
this
.
2
}}{{
..
/
0
}}
,
{{
this
.
0
}}
,
{{
this
.
1
}}{{#
each
this
.
3
}}
,
{{
this
}}{{/
each
}}
{{/
each
}}{{/
each
}}
\ No newline at end of file
templates/jwinf/contestresults.hbs
View file @
aa00d8ac
...
...
@@ -8,22 +8,32 @@
<div
class=
"columns"
>
<div
class=
"column is-8 is-offset-2"
>
<h3
class=
"title is-4"
>
Ergebnisse in
{{
contest
.
name
}}
</h3>
</div></div>
<style>
td
{
padding-left
:
15px
;}
</style>
</div>
</div>
{{#if
result
}}
<div
class=
"columns"
>
<div
class=
"column is-8 is-offset-2"
>
<h4
class=
"subtitle is-5"
>
Ergebnisse herunterladen:
<a
href=
"download"
>
{{
contest
.
name
}}
.csv
</a>
</h4>
</div>
</div>
<style>
td
{
padding-left
:
15px
;}
td
:nth-child
(
3
)
{
font-weight
:
bold
;
}
</style>
<div
class=
"columns"
>
<div
class=
"column"
>
<table
class=
"table"
>
<tr>
<td>
Gruppe
</td>
<td>
Teilnehmer
</td>
<td>
Punkte
</td>
<tr>
<td></td>
<td></td>
<td>
Summe
</td>
<td>
Gesamtpunkte
</td>
{{#
each
taskname
}}
<td>
{{
this
}}
</td>
{{/
each
}}
...
...
@@ -31,23 +41,30 @@
{{#
each
result
}}
<tr
><td
><a
href=
"/group/
{{
this
.
1
}}
"
>
{{
this
.
0
}}
</a></td></tr>
<tr
style=
"background-color:#e5fae5;"
><td
style=
"max-width:200px;"
><a
href=
"/group/
{{
this
.
1
}}
"
>
{{
this
.
0
}}
</a></td><
td
colspan=
"12"
></td><
/tr>
{{#
each
this
.
2
}}
<tr><td></td>
<td><a
href=
"/user/
{{
this
.
1
}}
"
>
{{
this
.
0
}}
</a></td>
{{#
each
this
.
2
}}
<td><a
href=
"/user/
{{
this
.
2
}}
"
>
{{
this
.
0
}}
{{
this
.
1
}}
</a></td>
{{#
each
this
.
3
}}
<td>
{{
this
}}
</td>
{{/
each
}}
{{/
each
}}
</tr>
{{/
each
}}
</table>
</div>
</div>
{{else}}
<em>
Für diesen Wettbewerb sind noch keine Ergebnisse Ihrer Gruppen verzeichnet.
</em>
<div
class=
"columns"
>
<div
class=
"column is-8 is-offset-2"
>
<p>
<em>
Für diesen Wettbewerb sind noch keine Ergebnisse Ihrer Gruppen verzeichnet.
</em>
</p>
</div>
</div>
{{/if}}
</div>
</div>
{{/
inline
}}
{{~>
(
parent
)
~}}
templates/jwinf/contestresults_download.hbs
0 → 120000
View file @
aa00d8ac
../default/contestresults_download.hbs
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment