feat: filter abnormal users
This commit is contained in:
@@ -263,18 +263,23 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "fetchall")]
|
||||
Commands::ScrapeAllB50 { concurrency } => {
|
||||
Commands::ScrapeAllB50 {
|
||||
concurrency,
|
||||
min_rating,
|
||||
max_rating,
|
||||
} => {
|
||||
use sdgb_api::title::methods;
|
||||
|
||||
use crate::{
|
||||
cache::{PLAYER_B50, PLAYERS},
|
||||
utils::helpers::{cached_concurrent_fetch, read_cache_keys},
|
||||
utils::helpers::{cached_concurrent_fetch, read_cache},
|
||||
};
|
||||
|
||||
let user_ids = read_cache_keys(PLAYERS)?;
|
||||
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
players.retain(|p| p.player_rating >= min_rating && p.player_rating <= max_rating);
|
||||
|
||||
cached_concurrent_fetch::<methods::GetUserRatingApi>(
|
||||
user_ids,
|
||||
players.iter().map(|p| p.user_id).collect::<Vec<u32>>(),
|
||||
&client,
|
||||
concurrency,
|
||||
PLAYER_B50,
|
||||
|
||||
Reference in New Issue
Block a user