Commit 4d5af089 authored by Robert Czechowski's avatar Robert Czechowski

Admin page: Contest export: Export into file: Generate file

parent e28a06dd
......@@ -1288,11 +1288,11 @@ pub fn admin_contest_export<T: MedalConnection>(conn: &T, contest_id: i32, sessi
let taskgroup_ids: Vec<(i32, String)> =
contest.taskgroups.into_iter().map(|tg| (tg.id.unwrap(), tg.name)).collect();
let filename = "./export/blub.csv";
let filename = format!("contest_{}__{}__{}.csv", contest_id, self::time::strftime("%F_%H-%M-%S", &self::time::now()).unwrap(), helpers::make_filename_secret());
let contest = conn.export_contest_results_to_file(contest_id, &taskgroup_ids, filename);
conn.export_contest_results_to_file(contest_id, &taskgroup_ids, &format!("./export/{}", filename));
Ok("blub.csv".to_string())
Ok(filename)
}
#[derive(PartialEq)]
......
......@@ -25,6 +25,8 @@ pub fn make_csrf_token() -> String { thread_rng().sample_iter(&Alphanumeric).tak
pub fn make_salt() -> String { thread_rng().sample_iter(&Alphanumeric).take(10).collect() }
pub fn make_filename_secret() -> String { thread_rng().sample_iter(&Alphanumeric).take(10).collect() }
pub fn make_group_code() -> String {
Some('g').into_iter()
.chain(thread_rng().sample_iter(&Alphanumeric))
......
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