Commit 837a494b authored by Robert Czechowski's avatar Robert Czechowski

Merge branch 'v1.5' into deploy

parents 629f04b9 4233f0ea
Pipeline #857 passed with stages
in 20 minutes and 29 seconds
......@@ -1064,7 +1064,7 @@ checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48"
[[package]]
name = "medal"
version = "1.5.1"
version = "1.5.3"
dependencies = [
"bcrypt",
"csv",
......
[package]
version = "1.5.1"
version = "1.5.3"
name = "medal"
authors = ["Robert Czechowski <czechowski@bwinf.de>", "Daniel Brüning <bruening@bwinf.de>"]
......
......@@ -1391,8 +1391,7 @@ pub fn admin_show_participation<T: MedalConnection>(conn: &T, user_id: i32, cont
fill_user_data(&user, &mut data);
data.insert("userid".to_string(), to_json(&user.id));
let participation =
conn.get_participation(user.id, contest_id).ok_or(MedalError::AccessDenied)?;
let participation = conn.get_participation(user.id, contest_id).ok_or(MedalError::AccessDenied)?;
data.insert("start_date".to_string(),
to_json(&self::time::strftime("%FT%T%z", &self::time::at(participation.start)).unwrap()));
......
......@@ -421,6 +421,10 @@ impl MedalConnection for Connection {
//TODO: use session
fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> {
if logincode == "" {
return Err(());
}
let query = "SELECT id
FROM session
WHERE logincode = $1";
......@@ -506,6 +510,10 @@ impl MedalConnection for Connection {
//TODO: use session
fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> {
if groupcode == "" {
return Err(());
}
let query = "SELECT id
FROM usergroup
WHERE groupcode = $1";
......@@ -947,7 +955,8 @@ impl MedalConnection for Connection {
row.get::<_, Option<String>>(16),
row.get::<_, Option<String>>(17)),
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))
.unwrap();
})
......@@ -1111,8 +1120,8 @@ impl MedalConnection for Connection {
WHERE session = $1
AND contest = $2";
self.query_map_one(query, &[&session_id, &contest_id], |row| Participation { contest: contest_id,
user: session_id,
start: row.get(0) })
user: session_id,
start: row.get(0) })
.ok()?
}
......
......@@ -533,6 +533,10 @@ impl MedalConnection for Connection {
//TODO: use session
fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> {
if logincode == "" {
return Err(());
}
let query = "SELECT id
FROM session
WHERE logincode = $1";
......@@ -618,6 +622,10 @@ impl MedalConnection for Connection {
//TODO: use session
fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> {
if groupcode == "" {
return Err(());
}
let query = "SELECT id
FROM usergroup
WHERE groupcode = $1";
......@@ -1059,7 +1067,8 @@ impl MedalConnection for Connection {
row.get::<_, Option<String>>(16),
row.get::<_, Option<String>>(17)),
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))
.unwrap();
})
......@@ -1223,8 +1232,8 @@ impl MedalConnection for Connection {
WHERE session = $1
AND contest = $2";
self.query_map_one(query, &[&session_id, &contest_id], |row| Participation { contest: contest_id,
user: session_id,
start: row.get(0) })
user: session_id,
start: row.get(0) })
.ok()?
}
......
......@@ -533,6 +533,10 @@ impl MedalConnection for Connection {
//TODO: use session
fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> {
if logincode == "" {
return Err(());
}
let query = "SELECT id
FROM session
WHERE logincode = ?1";
......@@ -618,6 +622,10 @@ impl MedalConnection for Connection {
//TODO: use session
fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> {
if groupcode == "" {
return Err(());
}
let query = "SELECT id
FROM usergroup
WHERE groupcode = ?1";
......@@ -1059,7 +1067,8 @@ impl MedalConnection for Connection {
row.get::<_, Option<String>>(16),
row.get::<_, Option<String>>(17)),
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))
.unwrap();
})
......@@ -1223,8 +1232,8 @@ impl MedalConnection for Connection {
WHERE session = ?1
AND contest = ?2";
self.query_map_one(query, &[&session_id, &contest_id], |row| Participation { contest: contest_id,
user: session_id,
start: row.get(0) })
user: session_id,
start: row.get(0) })
.ok()?
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment