Skip to content

Commit

Permalink
change mobile sub location criteria (#601)
Browse files Browse the repository at this point in the history
* revert mobile sub location criteria to 1/day

* change to not cleanout subscriber_loc_verified table

* remove time constraint from subscriber rewards

---------

Co-authored-by: Brian Balser <bbalser@nova-labs.com>
  • Loading branch information
jeffgrunewald and bbalser committed Aug 14, 2023
1 parent 16558aa commit 2e295ef
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions mobile_verifier/src/subscriber_location.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use chrono::{DateTime, Duration, Utc};
use chrono::{DateTime, Utc};
use file_store::{
file_info_poller::FileInfoStream,
file_sink::FileSinkClient,
Expand All @@ -18,8 +18,6 @@ use sqlx::{PgPool, Postgres, Transaction};
use std::ops::Range;
use tokio::sync::mpsc::Receiver;

const SUBSCRIBER_REWARD_PERIOD_LENGTH_IN_DAYS: i64 = 14;

pub type SubscriberValidatedLocations = Vec<Vec<u8>>;

pub struct SubscriberLocationIngestor {
Expand Down Expand Up @@ -175,13 +173,11 @@ pub struct SubscriberLocationShare {

pub async fn aggregate_location_shares(
db: impl sqlx::PgExecutor<'_> + Copy,
reward_period: &Range<DateTime<Utc>>,
_reward_period: &Range<DateTime<Utc>>,
) -> Result<SubscriberValidatedLocations, sqlx::Error> {
let mut rows = sqlx::query_as::<_, SubscriberLocationShare>(
"select distinct(subscriber_id) from subscriber_loc_verified where received_timestamp >= $1 and received_timestamp < $2",
"select distinct(subscriber_id) from subscriber_loc_verified",
)
.bind(reward_period.end - Duration::days(SUBSCRIBER_REWARD_PERIOD_LENGTH_IN_DAYS))
.bind(reward_period.end)
.fetch(db);
let mut location_shares = SubscriberValidatedLocations::new();
while let Some(share) = rows.try_next().await? {
Expand Down

0 comments on commit 2e295ef

Please sign in to comment.