diff --git a/.gitea/workflows/loxide_lib.yml b/.gitea/workflows/loxide_lib.yml index a49b143..0a21747 100644 --- a/.gitea/workflows/loxide_lib.yml +++ b/.gitea/workflows/loxide_lib.yml @@ -2,7 +2,7 @@ name: Build Library run-name: ${{ gitea.actor }} on: push: - braches: + branches: - RustImplementation paths: - airlock_libs/** diff --git a/airlock_libs/Cargo.lock b/airlock_libs/Cargo.lock index 70327a0..a3d9b52 100644 --- a/airlock_libs/Cargo.lock +++ b/airlock_libs/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "airlock_libs" -version = "1.0.3" +version = "2.0.0" dependencies = [ "chrono", "indicatif", diff --git a/airlock_libs/Cargo.toml b/airlock_libs/Cargo.toml index 15f8786..3a853d9 100644 --- a/airlock_libs/Cargo.toml +++ b/airlock_libs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "airlock_libs" -version = "1.0.3" +version = "2.0.0" edition = "2024" [lib] diff --git a/airlock_libs/pyproject.toml b/airlock_libs/pyproject.toml index 2f78abd..e7cd8aa 100644 --- a/airlock_libs/pyproject.toml +++ b/airlock_libs/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "airlock_libs" -version = "1.0.3" +version = "2.0.0" description = "Airlock Digital API Wrapper" readme = "README.md" license = { text = "AGPL-3.0-only" } diff --git a/airlock_libs/src/services.rs b/airlock_libs/src/services.rs index 5056344..8870d5c 100644 --- a/airlock_libs/src/services.rs +++ b/airlock_libs/src/services.rs @@ -13,7 +13,7 @@ use std::{ env, fmt::Write, fs::{self, File}, - io::Read, + io::{Read, Seek, SeekFrom}, path::PathBuf, str::FromStr, }; @@ -96,7 +96,9 @@ pub fn pull_policy_exec_histories( let client = build_client(py, &py_self); let api: Py = py_self; let cutoff = Local::now().naive_local() - Duration::days(days); + let mut f = File::open(&writeable_filepath).unwrap(); loop { + f.seek(SeekFrom::Start(0)).unwrap(); let execution_histories = history_logging( py, &api, @@ -110,7 +112,6 @@ pub fn pull_policy_exec_histories( break; } let mut seen: HashMap<(String, String, String), Group> = if writeable_filepath.exists() { - let mut f = File::open(&writeable_filepath).unwrap(); let mut contents = String::new(); f.read_to_string(&mut contents).unwrap(); let existing_data: ApiResponse = @@ -177,8 +178,7 @@ pub fn pull_policy_exec_histories( ) { let date_diff = Local::now().naive_local().date() - last_date; - let percentage_diff = - ((days + 10) - date_diff.num_days()) as f64 / (days + 10) as f64 * 100.0; + let percentage_diff = (days - date_diff.num_days()) as f64 / days as f64 * 100.0; progress_bar.set_position(percentage_diff.round() as u64); progress_bar.set_message("Total Percent Complete"); } diff --git a/requirements.txt b/requirements.txt index 34abeed..1141830 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,4 @@ tqdm==4.67.1 urllib3==2.5.0 --extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/ -airlock_libs==1.0.3 \ No newline at end of file +airlock_libs==2.0.0 \ No newline at end of file