Skip to content

Commit

Permalink
feat: create a copy of data for rosctober
Browse files Browse the repository at this point in the history
  • Loading branch information
akorchyn committed Nov 4, 2024
1 parent 935369f commit cf57970
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion contract/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ impl Contract {
#[init(ignore_state)]
#[private]
pub fn migrate() -> Self {
let state: Self = env::state_read().unwrap();
let mut state: Self = env::state_read().unwrap();

let users = state.users.len();
for user_id in 0..users {
let period_data = state.period_data(user_id, &"102024".to_string());
if let Some(period_data) = period_data {
state.sloths_per_period.insert(
(user_id, "rosctober2024".to_string()),
VersionedUserPeriodData::V2(period_data),
);
}
}

state
}
Expand Down
1 change: 1 addition & 0 deletions server/src/contract_pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async fn fetch_and_store_users(
let periods = [TimePeriod::Month, TimePeriod::Quarter, TimePeriod::AllTime]
.into_iter()
.map(|e| e.time_string(timestamp as u64))
.chain(std::iter::once(String::from("rosctober2024")))
.collect();
let users = near_client
.users(periods)
Expand Down

0 comments on commit cf57970

Please sign in to comment.