From 574a67dd4ecc13162183614c44be36e75359b8cc Mon Sep 17 00:00:00 2001 From: mostafaei2002 Date: Fri, 7 Jun 2024 15:25:14 +0330 Subject: [PATCH] fix: add dev branch to workflows --- .github/workflows/ci.yml | 2 +- .github/workflows/typo.yml | 2 +- src/helper/xvb/algorithm.rs | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24690b8..dc9b730 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ "main" ] + branches: [ "main", "dev" ] pull_request: branches: [ "main" ] diff --git a/.github/workflows/typo.yml b/.github/workflows/typo.yml index 91235c8..9cf9e24 100644 --- a/.github/workflows/typo.yml +++ b/.github/workflows/typo.yml @@ -4,7 +4,7 @@ name: Typo on: push: - branches: [ "main" ] + branches: [ "main", "dev" ] pull_request: branches: [ "main" ] diff --git a/src/helper/xvb/algorithm.rs b/src/helper/xvb/algorithm.rs index 7010dc0..40fc6b6 100644 --- a/src/helper/xvb/algorithm.rs +++ b/src/helper/xvb/algorithm.rs @@ -83,8 +83,13 @@ pub(crate) fn calcul_donated_time( default_spared_time }, RuntimeMode::ManuallyDonate => { - let donate_hr = lock!(gui_api_xvb).stats_priv.runtime_manual_amount; + let mut donate_hr = lock!(gui_api_xvb).stats_priv.runtime_manual_amount; info!("RuntimeMode::ManuallyDonate - lhr:{lhr} donate_hr:{donate_hr}"); + + if donate_hr > (lhr as u64) { + donate_hr = lhr as u64; + } + if lhr < 1.0 { default_spared_time } else { @@ -92,8 +97,13 @@ pub(crate) fn calcul_donated_time( } }, RuntimeMode::ManuallyKeep => { - let keep_hr = lock!(gui_api_xvb).stats_priv.runtime_manual_amount; + let mut keep_hr = lock!(gui_api_xvb).stats_priv.runtime_manual_amount; info!("RuntimeMode::ManuallyDonate - lhr:{lhr} keep_hr:{keep_hr}"); + + if keep_hr > (lhr as u64) { + keep_hr = lhr as u64; + } + if lhr < 1.0 { default_spared_time } else {