Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan committed Jul 26, 2024
1 parent fcb56e3 commit 5ef247b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/canisters/airdrop_bot/impl/src/model/airdrops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl Airdrops {
}
}

if ticket_holders.is_empty() || total_shares == 0 {
if total_shares == 0 {
return None;
}

Expand Down Expand Up @@ -152,6 +152,10 @@ impl Airdrops {
let mut lottery_winners = Vec::new();

for i in 0..prizes {
if ticket_holders.is_empty() {
break;
}

let winning_ticket = (rng.next_u32() % ticket_holders.len() as u32) as usize;

let winner = ticket_holders.remove(winning_ticket);
Expand All @@ -163,10 +167,6 @@ impl Airdrops {
block_index: None,
},
));

if ticket_holders.is_empty() {
break;
}
}

let airdrop = Airdrop {
Expand Down

0 comments on commit 5ef247b

Please sign in to comment.