feat: add timestamp to benchmark submissions
This commit is contained in:
parent
78daff1036
commit
21ff6741a0
2 changed files with 8 additions and 3 deletions
2
migrations/20230131114916_survey_bench_date.sql
Normal file
2
migrations/20230131114916_survey_bench_date.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE survey_responses
|
||||||
|
ADD COLUMN submitted_at TIMESTAMPTZ NOT NULL DEFAULT now();
|
|
@ -214,6 +214,7 @@ async fn submit(
|
||||||
|
|
||||||
let user_id = Uuid::from_str(&username).unwrap();
|
let user_id = Uuid::from_str(&username).unwrap();
|
||||||
let payload = payload.into_inner();
|
let payload = payload.into_inner();
|
||||||
|
let now = OffsetDateTime::now_utc();
|
||||||
|
|
||||||
struct ID {
|
struct ID {
|
||||||
id: i32,
|
id: i32,
|
||||||
|
@ -225,14 +226,16 @@ async fn submit(
|
||||||
campaign_id,
|
campaign_id,
|
||||||
device_user_provided,
|
device_user_provided,
|
||||||
device_software_recognised,
|
device_software_recognised,
|
||||||
threads
|
threads,
|
||||||
) VALUES ($1, $2, $3, $4, $5)
|
submitted_at
|
||||||
|
) VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
RETURNING ID;",
|
RETURNING ID;",
|
||||||
&user_id,
|
&user_id,
|
||||||
&campaign_id,
|
&campaign_id,
|
||||||
&payload.device_user_provided,
|
&payload.device_user_provided,
|
||||||
&payload.device_software_recognised,
|
&payload.device_software_recognised,
|
||||||
&payload.threads
|
&payload.threads,
|
||||||
|
&now
|
||||||
)
|
)
|
||||||
.fetch_one(&data.db)
|
.fetch_one(&data.db)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in a new issue