Commit 9d2022a7 authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Restyle database status page

parent 141d6717
Pipeline #423 passed with stages
in 13 minutes and 18 seconds
...@@ -411,8 +411,8 @@ impl MedalConnection for Connection { ...@@ -411,8 +411,8 @@ impl MedalConnection for Connection {
} }
//TODO: use session //TODO: use session
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool, firstname: &str, fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
lastname: &str) firstname: &str, lastname: &str)
-> Result<String, ()> -> Result<String, ()>
{ {
let session_token = helpers::make_session_token(); let session_token = helpers::make_session_token();
...@@ -443,7 +443,7 @@ impl MedalConnection for Connection { ...@@ -443,7 +443,7 @@ impl MedalConnection for Connection {
&csrf_token, &csrf_token,
&now, &now,
&false, &false,
&(if is_teacher {255} else {0}), &(if is_teacher { 255 } else { 0 }),
&is_teacher, &is_teacher,
&foreign_id, &foreign_id,
&provider_id, &provider_id,
...@@ -1051,7 +1051,7 @@ impl MedalConnection for Connection { ...@@ -1051,7 +1051,7 @@ impl MedalConnection for Connection {
let query = "SELECT count(*) let query = "SELECT count(*)
FROM session;"; FROM session;";
let n_session: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap(); let n_session: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*) let query = "SELECT count(*)
FROM session FROM session
WHERE oauth_foreign_id NOT NULL OR logincode NOT NULL;"; WHERE oauth_foreign_id NOT NULL OR logincode NOT NULL;";
...@@ -1075,7 +1075,19 @@ impl MedalConnection for Connection { ...@@ -1075,7 +1075,19 @@ impl MedalConnection for Connection {
FROM submission;"; FROM submission;";
let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap(); let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
format!("{{Active Sessions: {}, Active Participations: {}, Session: {}, User: {}, PMS-User: {}, Teacher: {}, Participations: {}, Submissions: {}}}", n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub) format!(
"{{
'active_sessions': {},
'active_participations': {},
'sessions': {},
'users': {},
'pms_users': {},
'teachers': {},
'participations': {},
'submissions': {}
}}",
n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub
)
} }
fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = $1", &[&false]).unwrap(); } fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = $1", &[&false]).unwrap(); }
......
...@@ -1171,7 +1171,19 @@ impl MedalConnection for Connection { ...@@ -1171,7 +1171,19 @@ impl MedalConnection for Connection {
FROM submission;"; FROM submission;";
let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap(); let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
format!("{{Active Sessions: {}, Active Participations: {}, Session: {}, User: {}, PMS-User: {}, Teacher: {}, Participations: {}, Submissions: {}}}", n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub) format!(
"{{
'active_sessions': {},
'active_participations': {},
'sessions': {},
'users': {},
'pms_users': {},
'teachers': {},
'participations': {},
'submissions': {}
}}",
n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub
)
} }
fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = $1", &[&false]).unwrap(); } fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = $1", &[&false]).unwrap(); }
......
...@@ -1158,7 +1158,19 @@ impl MedalConnection for Connection { ...@@ -1158,7 +1158,19 @@ impl MedalConnection for Connection {
FROM submission;"; FROM submission;";
let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap(); let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
format!("{{Active Sessions: {}, Active Participations: {}, Session: {}, User: {}, PMS-User: {}, Teacher: {}, Participations: {}, Submissions: {}}}", n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub) format!(
"{{
'active_sessions': {},
'active_participations': {},
'sessions': {},
'users': {},
'pms_users': {},
'teachers': {},
'participations': {},
'submissions': {}
}}",
n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub
)
} }
fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = ?1", &[&false]).unwrap(); } fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = ?1", &[&false]).unwrap(); }
......
...@@ -1171,7 +1171,19 @@ impl MedalConnection for Connection { ...@@ -1171,7 +1171,19 @@ impl MedalConnection for Connection {
FROM submission;"; FROM submission;";
let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap(); let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
format!("{{Active Sessions: {}, Active Participations: {}, Session: {}, User: {}, PMS-User: {}, Teacher: {}, Participations: {}, Submissions: {}}}", n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub) format!(
"{{
'active_sessions': {},
'active_participations': {},
'sessions': {},
'users': {},
'pms_users': {},
'teachers': {},
'participations': {},
'submissions': {}
}}",
n_asession, n_apart, n_session, n_user, n_pmsuser, n_teacher, n_part, n_sub
)
} }
fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = ?1", &[&false]).unwrap(); } fn reset_all_contest_visibilities(&self) { self.execute("UPDATE contest SET public = ?1", &[&false]).unwrap(); }
......
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