Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
medal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
43
Issues
43
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bwinf
medal
Commits
67371390
Commit
67371390
authored
Jul 07, 2020
by
Robert Czechowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admin page: Contest export: Export into file: Download file
parent
b3bfcf4d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
4 deletions
+10
-4
export/.keep
export/.keep
+0
-0
src/core.rs
src/core.rs
+1
-1
src/db_conn.base.rs
src/db_conn.base.rs
+3
-1
src/db_conn_postgres.rs
src/db_conn_postgres.rs
+3
-1
src/db_conn_sqlite_new.rs
src/db_conn_sqlite_new.rs
+3
-1
No files found.
export/.keep
0 → 100644
View file @
67371390
src/core.rs
View file @
67371390
...
...
@@ -1292,7 +1292,7 @@ pub fn admin_contest_export<T: MedalConnection>(conn: &T, contest_id: i32, sessi
let
contest
=
conn
.export_contest_results_to_file
(
contest_id
,
&
taskgroup_ids
,
filename
);
Ok
(
"blub"
.to_string
())
Ok
(
"blub
.csv
"
.to_string
())
}
#[derive(PartialEq)]
...
...
src/db_conn.base.rs
View file @
67371390
...
...
@@ -809,7 +809,7 @@ impl MedalConnection for Connection {
/* Warning: This function makes no use of rusts type safety. Handle with care when changeing */
fn
export_contest_results_to_file
(
&
self
,
contest_id
:
i32
,
taskgroups
:
&
[(
i32
,
String
)],
filename
:
&
str
)
{
use
std
::
fs
::
OpenOptions
;
let
file
=
OpenOptions
::
new
()
.write
(
true
)
.create
(
true
)
.truncate
(
true
)
.open
(
"foo.txt"
)
.unwrap
();
let
file
=
OpenOptions
::
new
()
.write
(
true
)
.create
(
true
)
.truncate
(
true
)
.open
(
filename
)
.unwrap
();
let
mut
headers
=
vec!
[
"id"
,
"username"
,
"logincode"
,
...
...
@@ -885,6 +885,8 @@ impl MedalConnection for Connection {
for
i
in
20
..
20
+
taskgroups
.len
()
{
points
.push
(
row
.get
::
<
_
,
Option
<
i32
>>
(
i
));
}
// Serialized as several tuples because Serde only supports tuples up to a certain length
// (16 according to https://docs.serde.rs/serde/trait.Deserialize.html)
wtr
.serialize
(((
row
.get
::
<
_
,
i32
>
(
0
),
row
.get
::
<
_
,
Option
<
String
>>
(
1
),
row
.get
::
<
_
,
Option
<
String
>>
(
2
),
...
...
src/db_conn_postgres.rs
View file @
67371390
...
...
@@ -919,7 +919,7 @@ impl MedalConnection for Connection {
/* Warning: This function makes no use of rusts type safety. Handle with care when changeing */
fn
export_contest_results_to_file
(
&
self
,
contest_id
:
i32
,
taskgroups
:
&
[(
i32
,
String
)],
filename
:
&
str
)
{
use
std
::
fs
::
OpenOptions
;
let
file
=
OpenOptions
::
new
()
.write
(
true
)
.create
(
true
)
.truncate
(
true
)
.open
(
"foo.txt"
)
.unwrap
();
let
file
=
OpenOptions
::
new
()
.write
(
true
)
.create
(
true
)
.truncate
(
true
)
.open
(
filename
)
.unwrap
();
let
mut
headers
=
vec!
[
"id"
,
"username"
,
"logincode"
,
...
...
@@ -995,6 +995,8 @@ impl MedalConnection for Connection {
for
i
in
20
..
20
+
taskgroups
.len
()
{
points
.push
(
row
.get
::
<
_
,
Option
<
i32
>>
(
i
));
}
// Serialized as several tuples because Serde only supports tuples up to a certain length
// (16 according to https://docs.serde.rs/serde/trait.Deserialize.html)
wtr
.serialize
(((
row
.get
::
<
_
,
i32
>
(
0
),
row
.get
::
<
_
,
Option
<
String
>>
(
1
),
row
.get
::
<
_
,
Option
<
String
>>
(
2
),
...
...
src/db_conn_sqlite_new.rs
View file @
67371390
...
...
@@ -919,7 +919,7 @@ impl MedalConnection for Connection {
/* Warning: This function makes no use of rusts type safety. Handle with care when changeing */
fn
export_contest_results_to_file
(
&
self
,
contest_id
:
i32
,
taskgroups
:
&
[(
i32
,
String
)],
filename
:
&
str
)
{
use
std
::
fs
::
OpenOptions
;
let
file
=
OpenOptions
::
new
()
.write
(
true
)
.create
(
true
)
.truncate
(
true
)
.open
(
"foo.txt"
)
.unwrap
();
let
file
=
OpenOptions
::
new
()
.write
(
true
)
.create
(
true
)
.truncate
(
true
)
.open
(
filename
)
.unwrap
();
let
mut
headers
=
vec!
[
"id"
,
"username"
,
"logincode"
,
...
...
@@ -995,6 +995,8 @@ impl MedalConnection for Connection {
for
i
in
20
..
20
+
taskgroups
.len
()
{
points
.push
(
row
.get
::
<
_
,
Option
<
i32
>>
(
i
));
}
// Serialized as several tuples because Serde only supports tuples up to a certain length
// (16 according to https://docs.serde.rs/serde/trait.Deserialize.html)
wtr
.serialize
(((
row
.get
::
<
_
,
i32
>
(
0
),
row
.get
::
<
_
,
Option
<
String
>>
(
1
),
row
.get
::
<
_
,
Option
<
String
>>
(
2
),
...
...
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