Fix bug in blockage migration date, variable naming
This commit is contained in:
parent
a8be1a8043
commit
ae1420a5ea
|
@ -831,7 +831,7 @@ pub fn get_next_unlock(constants_str: String, lox_cred_str: String) -> Result<St
|
|||
days_to_next_level + constants.level_interval[trust_level as usize + 1];
|
||||
invitations_at_next_level = constants.level_invitations[trust_level as usize + 1];
|
||||
}
|
||||
let days_to_blockage_migrations =
|
||||
let days_to_blockage_migration_unlock =
|
||||
match trust_level < constants.min_blockage_migration_trust_level {
|
||||
// If the credential is greater than the minimum level that enables
|
||||
// migrating after a blockage, the time to unlock is 0, otherwise we
|
||||
|
@ -839,22 +839,23 @@ pub fn get_next_unlock(constants_str: String, lox_cred_str: String) -> Result<St
|
|||
true => {
|
||||
let mut blockage_days = days_to_next_level;
|
||||
let mut count = 1;
|
||||
while trust_level + count <= constants.min_blockage_migration_trust_level {
|
||||
blockage_days += constants.level_interval[trust_level as usize + 1];
|
||||
while trust_level + count < constants.min_blockage_migration_trust_level {
|
||||
blockage_days += constants.level_interval[trust_level as usize + count as usize];
|
||||
count += 1;
|
||||
}
|
||||
scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + blockage_days
|
||||
blockage_days
|
||||
}
|
||||
false => 0,
|
||||
};
|
||||
let days_to_level_unlock =
|
||||
let day_of_level_unlock =
|
||||
(scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_next_level) as i32;
|
||||
let level_unlock_date = JulianDay::new(days_to_level_unlock).to_date();
|
||||
let days_to_invite_unlock =
|
||||
let level_unlock_date = JulianDay::new(day_of_level_unlock).to_date();
|
||||
let day_of_invite_unlock =
|
||||
(scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_invite_inc) as i32;
|
||||
let invite_unlock_date = JulianDay::new(days_to_invite_unlock).to_date();
|
||||
let invite_unlock_date = JulianDay::new(day_of_invite_unlock).to_date();
|
||||
let day_of_blockage_migration_unlock = (scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_blockage_migration_unlock) as i32;
|
||||
let blockage_migration_unlock_date =
|
||||
JulianDay::new(days_to_blockage_migrations as i32).to_date();
|
||||
JulianDay::new(day_of_blockage_migration_unlock as i32).to_date();
|
||||
let next_unlock: lox_utils::LoxNextUnlock = lox_utils::LoxNextUnlock {
|
||||
trust_level_unlock_date: DateTime::<Utc>::from_naive_utc_and_offset(
|
||||
NaiveDateTime::new(level_unlock_date, NaiveTime::from_hms_opt(0, 0, 0).unwrap()),
|
||||
|
|
Loading…
Reference in New Issue