summaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2024-06-17 10:35:06 +0200
committerGitHub <[email protected]>2024-06-17 10:35:06 +0200
commitc6baa076dc41dd43b3888d713fcf39fa901d2cd3 (patch)
treeba345251131779e76c076d60971e4f7f066bf146 /src/routes
parent04cd0aee6d000073e49b80a530a40cdb176f7f10 (diff)
parent8268b826cc45f5b2bd31b72339cc310789ab22d4 (diff)
downloadwebol-c6baa076dc41dd43b3888d713fcf39fa901d2cd3.tar
webol-c6baa076dc41dd43b3888d713fcf39fa901d2cd3.tar.gz
webol-c6baa076dc41dd43b3888d713fcf39fa901d2cd3.zip
Merge pull request #37 from FxQnLr/time_update
Time update
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/start.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/routes/start.rs b/src/routes/start.rs
index 192a54a..e9436f1 100644
--- a/src/routes/start.rs
+++ b/src/routes/start.rs
@@ -16,7 +16,7 @@ use uuid::Uuid;
16 path = "/start/{id}", 16 path = "/start/{id}",
17 request_body = Option<SPayload>, 17 request_body = Option<SPayload>,
18 responses( 18 responses(
19 (status = 200, description = "start the device with the given id", body = [Response]) 19 (status = 200, description = "start device with the given id", body = [Response])
20 ), 20 ),
21 params( 21 params(
22 ("id" = String, Path, description = "device id") 22 ("id" = String, Path, description = "device id")
@@ -128,14 +128,14 @@ fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String {
128 uuid_ret 128 uuid_ret
129} 129}
130 130
131fn get_eta(times: Option<Vec<i64>>) -> i64 { 131fn get_eta(times: Option<Vec<u64>>) -> u64 {
132 let times = if let Some(times) = times { 132 let times = if let Some(times) = times {
133 times 133 times
134 } else { 134 } else {
135 vec![0] 135 vec![0]
136 }; 136 };
137 137
138 times.iter().sum::<i64>() / i64::try_from(times.len()).unwrap() 138 times.iter().sum::<u64>() / u64::try_from(times.len()).unwrap()
139} 139}
140 140
141#[derive(Deserialize, ToSchema)] 141#[derive(Deserialize, ToSchema)]