Skip to content

Commit

Permalink
Update leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles committed Aug 2, 2024
1 parent 0b91f08 commit 0a1c303
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::{read_state, Data};
use crate::{mutate_state, Data};
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::post_upgrade;
Expand All @@ -26,7 +26,7 @@ fn post_upgrade(args: Args) {

info!(version = %args.wasm_version, "Post-upgrade complete");

read_state(|state| {
mutate_state(|state| {
let account_id =
AccountIdentifier::from_hex("0d8b25153f3450c024a30694e8834d199387a9d9a0f2641d053719cc6068223c").unwrap();

Expand All @@ -36,5 +36,12 @@ fn post_upgrade(args: Args) {
break;
}
}

for user in state.data.users.iter() {
state
.data
.chit_leaderboard
.update_position(user.user_id, user.total_chit_earned());
}
});
}

0 comments on commit 0a1c303

Please sign in to comment.