From 94eb76c188dc019a4975e44c9a757d76d42f9da1 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Wed, 1 Feb 2023 15:27:26 +0530 Subject: [PATCH] feat: show timestamp in results page --- Cargo.toml | 2 +- src/api/v1/admin/campaigns.rs | 4 ++++ templates/panel/campaigns/results.html | 14 ++++++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e4efdba..bdf1b8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ mime = "0.3.16" #sailfish = "0.3.2" tracing = { version = "0.1.37", features = ["log"] } -tera = "1.17.1" +tera = { version="1.17.1", features=["builtins"]} #tokio = "1.11.0" diff --git a/src/api/v1/admin/campaigns.rs b/src/api/v1/admin/campaigns.rs index 221e208..0f37f52 100644 --- a/src/api/v1/admin/campaigns.rs +++ b/src/api/v1/admin/campaigns.rs @@ -163,6 +163,7 @@ pub mod runners { #[derive(Debug)] struct InternalSurveyResp { id: i32, + submitted_at: OffsetDateTime, user_id: Uuid, threads: Option, device_user_provided: String, @@ -198,6 +199,7 @@ pub mod runners { device_software_recognised, threads, user_id, + submitted_at, device_user_provided FROM survey_responses @@ -256,6 +258,7 @@ pub mod runners { user, device_user_provided: r.device_user_provided, device_software_recognised: r.device_software_recognised, + submitted_at: r.submitted_at.unix_timestamp(), id: r.id as usize, threads: r.threads.map(|t| t as usize), }) @@ -314,6 +317,7 @@ pub struct SurveyResponse { pub device_software_recognised: String, pub id: usize, pub threads: Option, + pub submitted_at: i64, pub benches: Vec, } diff --git a/templates/panel/campaigns/results.html b/templates/panel/campaigns/results.html index 7bf616f..b23adb1 100644 --- a/templates/panel/campaigns/results.html +++ b/templates/panel/campaigns/results.html @@ -11,6 +11,7 @@ Submission ID + Time (UTC) User ID Device make (user provided) Device make (detected) @@ -21,12 +22,13 @@ {% for sub in payload.submissions %} - {{ sub.id }} - {{ sub.user.id }} - {{ sub.device_user_provided }} - {{ sub.device_software_recognised }} - {{ sub.threads }} - + {{ sub.id }} + {{ sub.submitted_at | date(format="%Y-%m-%d %H:%M", timezone="GMT") }} + {{ sub.user.id }} + {{ sub.device_user_provided }} + {{ sub.device_software_recognised }} + {{ sub.threads }} +
Difficulty