Skip to content

Commit ff642c7

Browse files
committed
small fixes
1 parent 3c22b5d commit ff642c7

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

adview-manager/src/lib.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ impl Manager {
432432

433433
pub async fn get_next_ad_unit(&self) -> Result<Option<NextAdUnit>, Error> {
434434
let units_for_slot = self.get_market_demand_resp().await?;
435-
let campaigns = &units_for_slot.campaigns;
435+
let m_campaigns = &units_for_slot.campaigns;
436436
let fallback_unit = units_for_slot.fallback_unit;
437437
let targeting_input = units_for_slot.targeting_input_base;
438438

@@ -444,7 +444,7 @@ impl Manager {
444444

445445
// Stickiness is when we keep showing an ad unit for a slot for some time in order to achieve fair impression value
446446
// see https://github.com/AdExNetwork/adex-adview-manager/issues/65
447-
let sticky_result = self.get_sticky_ad_unit(campaigns, &hostname).await;
447+
let sticky_result = self.get_sticky_ad_unit(m_campaigns, &hostname).await;
448448
if let Some(sticky) = sticky_result {
449449
return Ok(Some(NextAdUnit {
450450
unit: sticky.unit,
@@ -461,19 +461,19 @@ impl Manager {
461461
let seed = BigNum::from(random as u64);
462462

463463
// Apply targeting, now with adView.* variables, and sort the resulting ad units
464-
let mut units_with_price = campaigns
464+
let mut units_with_price = m_campaigns
465465
.iter()
466-
.map(|campaign| {
466+
.map(|m_campaign| {
467467
// since we are in a Iterator.map(), we can't use async, so we block
468-
if block_on(self.is_campaign_sticky(campaign.campaign.id)) {
468+
if block_on(self.is_campaign_sticky(m_campaign.campaign.id)) {
469469
return vec![];
470470
}
471471

472-
let campaign_id = campaign.campaign.id;
472+
let campaign_id = m_campaign.campaign.id;
473473

474-
let mut unit_input = targeting_input.clone().with_campaign(campaign.campaign.clone());
474+
let mut unit_input = targeting_input.clone().with_campaign(m_campaign.campaign.clone());
475475

476-
campaign
476+
m_campaign
477477
.units_with_price
478478
.iter()
479479
.filter(|unit_with_price| {
@@ -490,7 +490,7 @@ impl Manager {
490490
let on_type_error = |error, rule| error!(&self.logger, "Rule evaluation error for {:?}", campaign_id; "error" => ?error, "rule" => ?rule);
491491

492492
targeting::eval_with_callback(
493-
&campaign.campaign.targeting_rules,
493+
&m_campaign.campaign.targeting_rules,
494494
&unit_input,
495495
&mut output,
496496
Some(on_type_error)
@@ -539,11 +539,11 @@ impl Manager {
539539

540540
// Return the results, with a fallback unit if there is one
541541
if let Some((unit_with_price, campaign_id)) = auction_winner {
542-
let validators = campaigns
542+
let validators = m_campaigns
543543
.iter()
544-
.find_map(|campaign| {
545-
if &campaign.campaign.id == campaign_id {
546-
Some(&campaign.campaign.validators)
544+
.find_map(|m_campaign| {
545+
if &m_campaign.campaign.id == campaign_id {
546+
Some(&m_campaign.campaign.validators)
547547
} else {
548548
None
549549
}

primitives/src/campaign.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,15 @@ use chrono::{
88
DateTime, Utc,
99
};
1010
use serde::{Deserialize, Serialize};
11+
use serde_with::with_prefix;
1112

1213
pub use {
1314
campaign_id::CampaignId,
1415
pricing::{Pricing, PricingBounds},
1516
validators::{ValidatorRole, Validators},
1617
};
1718

18-
// re-export the prefix module!
19-
pub mod prefix_active {
20-
use serde_with::with_prefix;
21-
22-
pub use prefix_active::*;
23-
24-
with_prefix!(prefix_active "active_");
25-
}
19+
with_prefix!(pub prefix_active "active_");
2620

2721
mod campaign_id {
2822
use crate::ToHex;

0 commit comments

Comments
 (0)