summaryrefslogtreecommitdiff
path: root/src/browser/mod.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-08-05 20:42:41 +0200
committerSanto Cariotti <santo@dcariotti.me>2021-08-05 20:42:41 +0200
commit7de7e53436df4f5abf131870a1f02f2d91379bf3 (patch)
tree93d154fbb5420bdb87835e8a06c51e1bc5aa222e /src/browser/mod.rs
parent5ddacf8e8131bacbcbd360b24c4c45b5380678ee (diff)
refactor: merge getters for faculties and spaces options
Diffstat (limited to 'src/browser/mod.rs')
-rw-r--r--src/browser/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/browser/mod.rs b/src/browser/mod.rs
index 1f44493..82c9c60 100644
--- a/src/browser/mod.rs
+++ b/src/browser/mod.rs
@@ -1,6 +1,6 @@
use std::collections::HashMap;
-use self::web_browser::{Browser, WEB_BROWSER};
+use self::web_browser::{Browser, ROOMS_URL, WEB_BROWSER};
use crate::Config;
use thirtyfour::prelude::WebDriverResult;
@@ -27,7 +27,7 @@ pub async unsafe fn login(credentials: &Config) -> WebDriverResult<()> {
/// Get the faculties available for booking a room
pub async unsafe fn get_faculties() -> WebDriverResult<Option<HashMap<String, String>>> {
if let Some(driver) = &WEB_BROWSER {
- if let Some(faculties) = driver.faculties().await? {
+ if let Some(faculties) = driver.get_options("dipartimento", ROOMS_URL).await? {
return Ok(Some(faculties));
}
}
@@ -38,7 +38,7 @@ pub async unsafe fn get_faculties() -> WebDriverResult<Option<HashMap<String, St
/// Get the spaces (rooms) available to book
pub async unsafe fn get_spaces() -> WebDriverResult<Option<HashMap<String, String>>> {
if let Some(driver) = &WEB_BROWSER {
- if let Some(spaces) = driver.spaces().await? {
+ if let Some(spaces) = driver.get_options("space", "").await? {
return Ok(Some(spaces));
}
}