Skip to content

Commit

Permalink
Cleanup (txh moogey)
Browse files Browse the repository at this point in the history
  • Loading branch information
macpie committed Aug 2, 2024
1 parent dae1300 commit 6f21b07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions mobile_verifier/src/reward_shares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ impl MapperShares {

// Create the MobileRewardShare for each subscriber
subscriber_rewards
.into_iter()
.filter(|(_, reward)| {
.into_values()
.filter(|reward| {
reward.discovery_location_amount > 0 || reward.verification_mapping_amount > 0
})
.map(move |(_, subscriber_reward)| {
.map(|subscriber_reward| {
let total_reward_amount = subscriber_reward.discovery_location_amount
+ subscriber_reward.verification_mapping_amount;

Expand Down
12 changes: 4 additions & 8 deletions mobile_verifier/src/verified_subscriber_mapping_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use file_store::{
verified_subscriber_mapping_event_ingest_report::VerifiedSubscriberMappingEventIngestReport,
FileStore, FileType,
};
use futures::{stream::StreamExt, TryStreamExt};
use futures::stream::StreamExt;
use sqlx::{Pool, Postgres, Transaction};
use std::ops::Range;
use task_manager::{ManagedTask, TaskManager};
Expand Down Expand Up @@ -127,7 +127,7 @@ pub async fn aggregate_verified_mapping_events(
db: impl sqlx::PgExecutor<'_> + Copy,
reward_period: &Range<DateTime<Utc>>,
) -> Result<VerifiedMappingEventShares, sqlx::Error> {
let mut rows = sqlx::query_as::<_, VerifiedMappingEventShare>(
let vme_shares = sqlx::query_as::<_, VerifiedMappingEventShare>(
"SELECT
subscriber_id,
SUM(total_reward_points) AS total_reward_points
Expand All @@ -139,12 +139,8 @@ pub async fn aggregate_verified_mapping_events(
)
.bind(reward_period.end - Duration::days(SUBSCRIBER_REWARD_PERIOD_IN_DAYS))
.bind(reward_period.end)
.fetch(db);

let mut vme_shares = VerifiedMappingEventShares::new();
while let Some(share) = rows.try_next().await? {
vme_shares.push(share)
}
.fetch_all(db)
.await?;

Ok(vme_shares)
}

0 comments on commit 6f21b07

Please sign in to comment.