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
d153c56e
Commit
d153c56e
authored
Sep 22, 2020
by
Robert Czechowski
Browse files
Fix contest export failing with postgres due to incorrect type expected from start_date field
parent
ed3c61df
Pipeline
#836
passed with stages
in 18 minutes and 41 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core.rs
View file @
d153c56e
...
@@ -1391,8 +1391,7 @@ pub fn admin_show_participation<T: MedalConnection>(conn: &T, user_id: i32, cont
...
@@ -1391,8 +1391,7 @@ pub fn admin_show_participation<T: MedalConnection>(conn: &T, user_id: i32, cont
fill_user_data
(
&
user
,
&
mut
data
);
fill_user_data
(
&
user
,
&
mut
data
);
data
.insert
(
"userid"
.to_string
(),
to_json
(
&
user
.id
));
data
.insert
(
"userid"
.to_string
(),
to_json
(
&
user
.id
));
let
participation
=
let
participation
=
conn
.get_participation
(
user
.id
,
contest_id
)
.ok_or
(
MedalError
::
AccessDenied
)
?
;
conn
.get_participation
(
user
.id
,
contest_id
)
.ok_or
(
MedalError
::
AccessDenied
)
?
;
data
.insert
(
"start_date"
.to_string
(),
data
.insert
(
"start_date"
.to_string
(),
to_json
(
&
self
::
time
::
strftime
(
"%FT%T%z"
,
&
self
::
time
::
at
(
participation
.start
))
.unwrap
()));
to_json
(
&
self
::
time
::
strftime
(
"%FT%T%z"
,
&
self
::
time
::
at
(
participation
.start
))
.unwrap
()));
...
...
src/db_conn.base.rs
View file @
d153c56e
...
@@ -947,7 +947,8 @@ impl MedalConnection for Connection {
...
@@ -947,7 +947,8 @@ impl MedalConnection for Connection {
row
.get
::
<
_
,
Option
<
String
>>
(
16
),
row
.get
::
<
_
,
Option
<
String
>>
(
16
),
row
.get
::
<
_
,
Option
<
String
>>
(
17
)),
row
.get
::
<
_
,
Option
<
String
>>
(
17
)),
row
.get
::
<
_
,
Option
<
i32
>>
(
18
),
row
.get
::
<
_
,
Option
<
i32
>>
(
18
),
row
.get
::
<
_
,
Option
<
String
>>
(
19
),
row
.get
::
<
_
,
Option
<
self
::
time
::
Timespec
>>
(
19
)
.map
(|
ts
|
self
::
time
::
strftime
(
"%FT%T%z"
,
&
self
::
time
::
at
(
ts
))
.unwrap
()),
points
))
points
))
.unwrap
();
.unwrap
();
})
})
...
@@ -1111,8 +1112,8 @@ impl MedalConnection for Connection {
...
@@ -1111,8 +1112,8 @@ impl MedalConnection for Connection {
WHERE session = $1
WHERE session = $1
AND contest = $2"
;
AND contest = $2"
;
self
.query_map_one
(
query
,
&
[
&
session_id
,
&
contest_id
],
|
row
|
Participation
{
contest
:
contest_id
,
self
.query_map_one
(
query
,
&
[
&
session_id
,
&
contest_id
],
|
row
|
Participation
{
contest
:
contest_id
,
user
:
session_id
,
user
:
session_id
,
start
:
row
.get
(
0
)
})
start
:
row
.get
(
0
)
})
.ok
()
?
.ok
()
?
}
}
...
...
src/db_conn_postgres.rs
View file @
d153c56e
...
@@ -1059,7 +1059,8 @@ impl MedalConnection for Connection {
...
@@ -1059,7 +1059,8 @@ impl MedalConnection for Connection {
row
.get
::
<
_
,
Option
<
String
>>
(
16
),
row
.get
::
<
_
,
Option
<
String
>>
(
16
),
row
.get
::
<
_
,
Option
<
String
>>
(
17
)),
row
.get
::
<
_
,
Option
<
String
>>
(
17
)),
row
.get
::
<
_
,
Option
<
i32
>>
(
18
),
row
.get
::
<
_
,
Option
<
i32
>>
(
18
),
row
.get
::
<
_
,
Option
<
String
>>
(
19
),
row
.get
::
<
_
,
Option
<
self
::
time
::
Timespec
>>
(
19
)
.map
(|
ts
|
self
::
time
::
strftime
(
"%FT%T%z"
,
&
self
::
time
::
at
(
ts
))
.unwrap
()),
points
))
points
))
.unwrap
();
.unwrap
();
})
})
...
@@ -1223,8 +1224,8 @@ impl MedalConnection for Connection {
...
@@ -1223,8 +1224,8 @@ impl MedalConnection for Connection {
WHERE session = $1
WHERE session = $1
AND contest = $2"
;
AND contest = $2"
;
self
.query_map_one
(
query
,
&
[
&
session_id
,
&
contest_id
],
|
row
|
Participation
{
contest
:
contest_id
,
self
.query_map_one
(
query
,
&
[
&
session_id
,
&
contest_id
],
|
row
|
Participation
{
contest
:
contest_id
,
user
:
session_id
,
user
:
session_id
,
start
:
row
.get
(
0
)
})
start
:
row
.get
(
0
)
})
.ok
()
?
.ok
()
?
}
}
...
...
src/db_conn_sqlite_new.rs
View file @
d153c56e
...
@@ -1059,7 +1059,8 @@ impl MedalConnection for Connection {
...
@@ -1059,7 +1059,8 @@ impl MedalConnection for Connection {
row
.get
::
<
_
,
Option
<
String
>>
(
16
),
row
.get
::
<
_
,
Option
<
String
>>
(
16
),
row
.get
::
<
_
,
Option
<
String
>>
(
17
)),
row
.get
::
<
_
,
Option
<
String
>>
(
17
)),
row
.get
::
<
_
,
Option
<
i32
>>
(
18
),
row
.get
::
<
_
,
Option
<
i32
>>
(
18
),
row
.get
::
<
_
,
Option
<
String
>>
(
19
),
row
.get
::
<
_
,
Option
<
self
::
time
::
Timespec
>>
(
19
)
.map
(|
ts
|
self
::
time
::
strftime
(
"%FT%T%z"
,
&
self
::
time
::
at
(
ts
))
.unwrap
()),
points
))
points
))
.unwrap
();
.unwrap
();
})
})
...
@@ -1223,8 +1224,8 @@ impl MedalConnection for Connection {
...
@@ -1223,8 +1224,8 @@ impl MedalConnection for Connection {
WHERE session = ?1
WHERE session = ?1
AND contest = ?2"
;
AND contest = ?2"
;
self
.query_map_one
(
query
,
&
[
&
session_id
,
&
contest_id
],
|
row
|
Participation
{
contest
:
contest_id
,
self
.query_map_one
(
query
,
&
[
&
session_id
,
&
contest_id
],
|
row
|
Participation
{
contest
:
contest_id
,
user
:
session_id
,
user
:
session_id
,
start
:
row
.get
(
0
)
})
start
:
row
.get
(
0
)
})
.ok
()
?
.ok
()
?
}
}
...
...
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