feat: display benchmark type
This commit is contained in:
parent
0fa21911f0
commit
1a466bbd3c
2 changed files with 31 additions and 19 deletions
|
@ -24,6 +24,7 @@ use uuid::Uuid;
|
||||||
|
|
||||||
use super::{get_admin_check_login, get_uuid};
|
use super::{get_admin_check_login, get_uuid};
|
||||||
use crate::api::v1::bench::Bench;
|
use crate::api::v1::bench::Bench;
|
||||||
|
use crate::api::v1::bench::SubmissionType;
|
||||||
use crate::errors::*;
|
use crate::errors::*;
|
||||||
use crate::AppData;
|
use crate::AppData;
|
||||||
|
|
||||||
|
@ -69,6 +70,8 @@ pub mod routes {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod runners {
|
pub mod runners {
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
use futures::try_join;
|
use futures::try_join;
|
||||||
|
|
||||||
use crate::api::v1::bench::Bench;
|
use crate::api::v1::bench::Bench;
|
||||||
|
@ -162,12 +165,13 @@ pub mod runners {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct InternalSurveyResp {
|
struct InternalSurveyResp {
|
||||||
id: i32,
|
id: Option<i32>,
|
||||||
submitted_at: OffsetDateTime,
|
submitted_at: Option<OffsetDateTime>,
|
||||||
user_id: Uuid,
|
user_id: Option<Uuid>,
|
||||||
threads: Option<i32>,
|
threads: Option<i32>,
|
||||||
device_user_provided: String,
|
device_user_provided: Option<String>,
|
||||||
device_software_recognised: String,
|
device_software_recognised: Option<String>,
|
||||||
|
name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -195,16 +199,19 @@ pub mod runners {
|
||||||
let mut db_responses = sqlx::query_as!(
|
let mut db_responses = sqlx::query_as!(
|
||||||
InternalSurveyResp,
|
InternalSurveyResp,
|
||||||
"SELECT
|
"SELECT
|
||||||
ID,
|
survey_responses.ID,
|
||||||
device_software_recognised,
|
survey_responses.device_software_recognised,
|
||||||
threads,
|
survey_responses.threads,
|
||||||
user_id,
|
survey_responses.user_id,
|
||||||
submitted_at,
|
survey_responses.submitted_at,
|
||||||
device_user_provided
|
survey_responses.device_user_provided,
|
||||||
|
survey_bench_type.name
|
||||||
FROM
|
FROM
|
||||||
survey_responses
|
survey_responses
|
||||||
|
INNER JOIN survey_bench_type ON
|
||||||
|
survey_responses.submission_bench_type_id = survey_bench_type.ID
|
||||||
WHERE
|
WHERE
|
||||||
campaign_id = (
|
survey_responses.campaign_id = (
|
||||||
SELECT ID FROM survey_campaigns
|
SELECT ID FROM survey_campaigns
|
||||||
WHERE
|
WHERE
|
||||||
ID = $1
|
ID = $1
|
||||||
|
@ -256,11 +263,13 @@ pub mod runners {
|
||||||
responses.push(SurveyResponse {
|
responses.push(SurveyResponse {
|
||||||
benches,
|
benches,
|
||||||
user,
|
user,
|
||||||
device_user_provided: r.device_user_provided,
|
device_user_provided: r.device_user_provided.unwrap(),
|
||||||
device_software_recognised: r.device_software_recognised,
|
device_software_recognised: r.device_software_recognised.unwrap(),
|
||||||
submitted_at: r.submitted_at.unix_timestamp(),
|
submitted_at: r.submitted_at.unwrap().unix_timestamp(),
|
||||||
id: r.id as usize,
|
id: r.id.unwrap() as usize,
|
||||||
threads: r.threads.map(|t| t as usize),
|
submission_type: SubmissionType::from_str(r.name.as_ref().unwrap())
|
||||||
|
.unwrap(),
|
||||||
|
threads: Some(r.threads.unwrap() as usize),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Ok(responses)
|
Ok(responses)
|
||||||
|
@ -318,6 +327,7 @@ pub struct SurveyResponse {
|
||||||
pub id: usize,
|
pub id: usize,
|
||||||
pub threads: Option<usize>,
|
pub threads: Option<usize>,
|
||||||
pub submitted_at: i64,
|
pub submitted_at: i64,
|
||||||
|
pub submission_type: SubmissionType,
|
||||||
pub benches: Vec<Bench>,
|
pub benches: Vec<Bench>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,6 +493,7 @@ mod tests {
|
||||||
device_software_recognised: DEVICE_SOFTWARE_RECOGNISED.into(),
|
device_software_recognised: DEVICE_SOFTWARE_RECOGNISED.into(),
|
||||||
threads: THREADS,
|
threads: THREADS,
|
||||||
benches: BENCHES.clone(),
|
benches: BENCHES.clone(),
|
||||||
|
submission_type: api::v1::bench::SubmissionType::Wasm,
|
||||||
};
|
};
|
||||||
|
|
||||||
let _proof =
|
let _proof =
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<th>Device make (user provided)</th>
|
<th>Device make (user provided)</th>
|
||||||
<th>Device make (detected)</th>
|
<th>Device make (detected)</th>
|
||||||
<th>Threads</th>
|
<th>Threads</th>
|
||||||
|
<th>Benchmark Type</th>
|
||||||
<th>Benches</th>
|
<th>Benches</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
<td>{{ sub.device_user_provided }}</td>
|
<td>{{ sub.device_user_provided }}</td>
|
||||||
<td>{{ sub.device_software_recognised }}</td>
|
<td>{{ sub.device_software_recognised }}</td>
|
||||||
<td>{{ sub.threads }}</td>
|
<td>{{ sub.threads }}</td>
|
||||||
|
<td>{{ sub.submission_type }}</td>
|
||||||
<td>
|
<td>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -43,8 +45,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</td>
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Add table
Reference in a new issue