Commit d8bbbee0 authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Transfer relative points from task to platform (integer percentage value)

parent 7fe42805
Pipeline #813 failed with stages
in 2 minutes and 19 seconds
......@@ -598,7 +598,7 @@ pub fn load_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token
}
pub fn save_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token: &str, csrf_token: &str,
data: String, grade: i32, subtask: Option<String>)
data: String, grade_percentage: i32, subtask: Option<String>)
-> MedalResult<String>
{
let session = conn.get_session(&session_token).ensure_alive().ok_or(MedalError::NotLoggedIn)?;
......@@ -607,7 +607,7 @@ pub fn save_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token
return Err(MedalError::CsrfCheckFailed);
}
let (_, _, c) = conn.get_task_by_id_complete(task_id);
let (t, _, c) = conn.get_task_by_id_complete(task_id);
match conn.get_participation(&session_token, c.id.expect("Value from database")) {
None => return Err(MedalError::AccessDenied),
......@@ -627,6 +627,8 @@ pub fn save_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token
}
}
let grade = (grade_percentage * t.stars) / 100;
let submission = Submission { id: None,
session_user: session.id,
task: task_id,
......
......@@ -16,7 +16,7 @@ $("body").prepend('<iframe src="' + location.search.substr(1) + '?language=pytho
var options = {
minScore:0,
maxScore:4,
maxScore:100,
noScore:0,
randomSeed:0,
readOnly:false,
......
......@@ -16,7 +16,7 @@ $("body").prepend('<iframe src="' + location.search.substr(1) + '?channelId=task
var options = {
minScore:0,
maxScore:4,
maxScore:100,
noScore:0,
randomSeed:0,
readOnly:false,
......
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