bug with index out-of-range in widget fixed with help of lowest common multiple, thanks to @ogenkidu and @metanomad

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-01-20 16:00:58 +03:00
parent f9233c6291
commit 6347474633
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
2 changed files with 1 additions and 3 deletions

View File

@ -11,4 +11,4 @@ pub use big_text::BigText;
pub use big_text::PixelSize;
pub use input::{Input, InputRequest};
const CYCLE: i64 = 1500;
const CYCLE: i64 = 1560;

View File

@ -14,8 +14,6 @@ impl Default for VerticalBlocks {
impl ToString for VerticalBlocks {
fn to_string(&self) -> String {
// TODO: how it can be equal to len()??
// do we really need super::CYCLE in denominator?
self.elements[((chrono::Utc::now().timestamp_millis() % super::CYCLE)
/ (super::CYCLE / self.elements.len() as i64)) as usize]
.to_owned()