Commit 7e85d3fe authored by Robert Czechowski's avatar Robert Czechowski

Show grade of user in admin view (fixes #132)

parent 6f86aa72
Pipeline #1178 failed with stages
in 3 minutes and 56 seconds
......@@ -1325,6 +1325,14 @@ pub fn admin_show_user<T: MedalConnection>(conn: &T, user_id: i32, session_token
fill_user_data(&user, &mut data);
data.insert("logincode".to_string(), to_json(&user.logincode));
data.insert("userid".to_string(), to_json(&user.id));
let grade = if user.grade >= 200 {
format!("Kein Schüler mehr")
} else if user.grade >= 11 {
format!("{} ({})", user.grade % 100, if user.grade >= 100 { "G9" } else { "G8" })
} else {
format!("{}", user.grade)
};
data.insert("grade".to_string(), to_json(&grade));
data.insert("oauthid".to_string(), to_json(&user.oauth_foreign_id));
data.insert("oauthprovider".to_string(), to_json(&user.oauth_provider));
......
......@@ -7,6 +7,7 @@
<strong>Id: {{userid}}</strong><br>
Vorname: {{firstname}}<br>
Nachname: {{lastname}}<br>
Jahrgangsstufe: {{grade}}<br>
{{#if username}}Benutzername: {{username}}<br>{{/if}}
{{#if logincode}}Logincode: {{logincode}}<br>{{/if}}
{{#if oauthid}}OAuth-Login: {{oauthprovider}} ({{oauthprovider}}-id: {{oauthid}})<br>{{/if}}
......
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