Commit a34c58d6 authored by Robert Czechowski's avatar Robert Czechowski

Admin interface: Separate oauth id and school id on contest export

parent 1ddf05ad
......@@ -881,6 +881,7 @@ impl MedalConnection for Connection {
"teacher_firstname",
"teacher_lastname",
"teacher_oauth_foreign_id",
"teacher_oauth_school_id",
"teacher_oauth_provider",
"contest_id",
"start_date"];
......@@ -941,6 +942,17 @@ impl MedalConnection for Connection {
for i in 20..20 + taskgroups.len() {
points.push(row.get::<_, Option<i32>>(i));
}
let teacher_oauth_and_school_id = row.get::<_, Option<String>>(15);
let (teacher_oauth_id, teacher_school_id) = if let Some(toasi) = teacher_oauth_and_school_id {
let mut v = toasi.split('/');
let oid: Option<String> = v.next().map(|s| s.to_owned());
let sid: Option<String> = v.next().map(|s| s.to_owned());
(oid, sid)
} else {
(None, None)
};
// 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),
......@@ -959,7 +971,8 @@ impl MedalConnection for Connection {
row.get::<_, Option<i32>>(13),
row.get::<_, Option<String>>(14),
row.get::<_, Option<String>>(15),
row.get::<_, Option<String>>(16),
teacher_oauth_id,
teacher_school_id,
row.get::<_, Option<String>>(17)),
row.get::<_, Option<i32>>(18),
row.get::<_, Option<self::time::Timespec>>(19)
......
......@@ -1000,6 +1000,7 @@ impl MedalConnection for Connection {
"teacher_firstname",
"teacher_lastname",
"teacher_oauth_foreign_id",
"teacher_oauth_school_id",
"teacher_oauth_provider",
"contest_id",
"start_date"];
......@@ -1060,6 +1061,17 @@ impl MedalConnection for Connection {
for i in 20..20 + taskgroups.len() {
points.push(row.get::<_, Option<i32>>(i));
}
let teacher_oauth_and_school_id = row.get::<_, Option<String>>(15);
let (teacher_oauth_id, teacher_school_id) = if let Some(toasi) = teacher_oauth_and_school_id {
let mut v = toasi.split('/');
let oid: Option<String> = v.next().map(|s| s.to_owned());
let sid: Option<String> = v.next().map(|s| s.to_owned());
(oid, sid)
} else {
(None, None)
};
// 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),
......@@ -1078,7 +1090,8 @@ impl MedalConnection for Connection {
row.get::<_, Option<i32>>(13),
row.get::<_, Option<String>>(14),
row.get::<_, Option<String>>(15),
row.get::<_, Option<String>>(16),
teacher_oauth_id,
teacher_school_id,
row.get::<_, Option<String>>(17)),
row.get::<_, Option<i32>>(18),
row.get::<_, Option<self::time::Timespec>>(19)
......
......@@ -1000,6 +1000,7 @@ impl MedalConnection for Connection {
"teacher_firstname",
"teacher_lastname",
"teacher_oauth_foreign_id",
"teacher_oauth_school_id",
"teacher_oauth_provider",
"contest_id",
"start_date"];
......@@ -1060,6 +1061,17 @@ impl MedalConnection for Connection {
for i in 20..20 + taskgroups.len() {
points.push(row.get::<_, Option<i32>>(i));
}
let teacher_oauth_and_school_id = row.get::<_, Option<String>>(15);
let (teacher_oauth_id, teacher_school_id) = if let Some(toasi) = teacher_oauth_and_school_id {
let mut v = toasi.split('/');
let oid: Option<String> = v.next().map(|s| s.to_owned());
let sid: Option<String> = v.next().map(|s| s.to_owned());
(oid, sid)
} else {
(None, None)
};
// 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),
......@@ -1078,7 +1090,8 @@ impl MedalConnection for Connection {
row.get::<_, Option<i32>>(13),
row.get::<_, Option<String>>(14),
row.get::<_, Option<String>>(15),
row.get::<_, Option<String>>(16),
teacher_oauth_id,
teacher_school_id,
row.get::<_, Option<String>>(17)),
row.get::<_, Option<i32>>(18),
row.get::<_, Option<self::time::Timespec>>(19)
......
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