Skip to content

Commit

Permalink
fix: typos and mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
VladasZ committed Nov 19, 2024
1 parent 7caf29a commit c3a58d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions contract/src/score/account_score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ impl AccountScore {
self.scores[1] = 0;

// If scores were updated yesterday we shift history by 1 day
// If older that yeterday then we wipe it
// If older that yesterday then we wipe it
if update_day == Local(today.0 - 1) {
self.scores[1] = self.scores[0];
self.scores[0] = 0;
self.scores_history[1] = self.scores_history[0];
self.scores_history[0] = 0;
} else {
self.scores_history = [0; DAYS_STORED];
}
Expand Down Expand Up @@ -242,9 +242,15 @@ mod test {
assert_eq!(score.updated, (MS_IN_DAY * 10).into());
assert_eq!(score.scores(), (1006, 2005));
assert_eq!(score.claim_score(), vec![2005]);
assert_eq!(score.active_score(), 2005);

ctx.set_block_timestamp_in_ms(MS_IN_DAY * 11);
assert_eq!(score.claim_score(), vec![1006, 0]);
assert_eq!(score.active_score(), 1006);

ctx.set_block_timestamp_in_ms(MS_IN_DAY * 12);
assert_eq!(score.claim_score(), vec![0, 0]);
assert_eq!(score.active_score(), 0);
}

#[test]
Expand Down
Binary file modified res/sweat_jar.wasm
Binary file not shown.

0 comments on commit c3a58d6

Please sign in to comment.