Commit 06a852a8 authored by Robert Czechowski's avatar Robert Czechowski

Fix clippy lint about too many arguments in login_foreign

parent 25a16348
Pipeline #687 passed with stage
in 12 minutes and 54 seconds
......@@ -1234,23 +1234,22 @@ pub fn admin_show_participation<T: MedalConnection>(conn: &T, user_id: i32, cont
let contest = conn.get_contest_by_id_complete(contest_id);
let subms: Vec<(String, Vec<(i32, Vec<(String, i32)>)>)> =
contest.taskgroups
.into_iter()
.map(|tg| {
(tg.name,
tg.tasks
.into_iter()
.map(|t| {
(t.stars,
let subms: Vec<(String, Vec<(i32, Vec<(String, i32)>)>)> = contest.taskgroups
.into_iter()
.map(|tg| {
(tg.name,
tg.tasks
.into_iter()
.map(|t| {
(t.stars,
conn.get_all_submissions(user_id, t.id.unwrap(), None)
.into_iter()
.map(|s| (self::time::strftime("%FT%T%z", &self::time::at(s.date)).unwrap(), s.grade))
.collect())
})
.collect())
})
.collect();
})
.collect())
})
.collect();
let mut data = json_val::Map::new();
data.insert("submissions".to_string(), to_json(&subms));
......@@ -1304,15 +1303,15 @@ pub fn login_oauth<T: MedalConnection>(conn: &T, user_data: ForeignUserData, oau
match conn.login_foreign(None,
&oauth_provider_id,
&user_data.foreign_id,
user_data.foreign_type != UserType::User,
user_data.foreign_type == UserType::Admin,
&user_data.firstname,
&user_data.lastname,
match user_data.sex {
UserSex::Male => Some(1),
UserSex::Female => Some(2),
UserSex::Unknown => Some(0),
}) {
(user_data.foreign_type != UserType::User,
user_data.foreign_type == UserType::Admin,
&user_data.firstname,
&user_data.lastname,
match user_data.sex {
UserSex::Male => Some(1),
UserSex::Female => Some(2),
UserSex::Unknown => Some(0),
})) {
Ok(session_token) => Ok(session_token),
Err(()) => {
let mut data = json_val::Map::new();
......
......@@ -441,8 +441,8 @@ impl MedalConnection for Connection {
}
//TODO: use session
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, (is_teacher, is_admin,
firstname, lastname, sex): (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>
{
let session_token = helpers::make_session_token();
......
......@@ -32,8 +32,8 @@ pub trait MedalConnection {
fn login(&self, session: Option<&str>, username: &str, password: &str) -> Result<String, ()>;
fn login_with_code(&self, session: Option<&str>, logincode: &str) -> Result<String, ()>;
fn login_foreign(&self, session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, session: Option<&str>, provider_id: &str, foreign_id: &str,
_: (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>;
fn create_user_with_groupcode(&self, session: Option<&str>, groupcode: &str) -> Result<String, ()>;
fn create_group_with_users(&self, group: Group);
......
......@@ -551,8 +551,8 @@ impl MedalConnection for Connection {
}
//TODO: use session
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str,
(is_teacher, is_admin, firstname, lastname, sex): (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>
{
let session_token = helpers::make_session_token();
......
......@@ -551,8 +551,8 @@ impl MedalConnection for Connection {
}
//TODO: use session
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str,
(is_teacher, is_admin, firstname, lastname, sex): (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>
{
let session_token = helpers::make_session_token();
......
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