Skip to content

Commit

Permalink
fix(best_selling): arreglar error
Browse files Browse the repository at this point in the history
  • Loading branch information
catdevnull committed Jun 23, 2024
1 parent 150f229 commit d00cdc6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scraper-rs/src/best_selling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,22 @@ pub async fn get_all_best_selling(db: &Db) -> anyhow::Result<Vec<BestSellingReco
.collect::<Vec<Vec<String>>>()
.map(|r| {
let ranked = rank_eans(r);
BestSellingRecord {
if ranked.is_empty() {
return None;
}
Some(BestSellingRecord {
fetched_at: Utc::now(),
category: category.clone(),
eans: ranked,
}
})
})
})
.buffer_unordered(5)
.boxed()
.filter_map(|f| async { f })
.collect::<Vec<BestSellingRecord>>()
.await;
if records.len() < 10 {
if records.len() < Category::value_variants().len() {
Err(SimpleError::new("Too few BestSellingRecords").into())
} else {
Ok(records)
Expand Down

0 comments on commit d00cdc6

Please sign in to comment.