Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify different queries that can prevent rewarding #918

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions mobile_verifier/src/rewarder/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ use std::ops::Range;
use chrono::{DateTime, Utc};
use sqlx::PgPool;

/// Heartbeats are sent constantly throughout the day.
///
/// If there are heartbeats that exists past the end of the rewardable period,
/// we can know that the heartbeat machinery has been working at least through
/// the period we're attempting to reward.
pub async fn no_cbrs_heartbeats(
pool: &PgPool,
reward_period: &Range<DateTime<Utc>>,
Expand All @@ -17,6 +22,11 @@ pub async fn no_cbrs_heartbeats(
Ok(count == 0)
}

/// Heartbeats are sent constantly throughout the day.
///
/// If there are heartbeats that exists past the end of the rewardable period,
/// we can know that the heartbeat machinery has been working at least through
/// the period we're attempting to reward.
pub async fn no_wifi_heartbeats(
pool: &PgPool,
reward_period: &Range<DateTime<Utc>>,
Expand All @@ -31,6 +41,11 @@ pub async fn no_wifi_heartbeats(
Ok(count == 0)
}

/// Speedtests are sent constantly throughout the day.
///
/// If there are speedtests that exists past the end of the rewardable period,
/// we can know that the speedtests machinery has been working at least through
/// the period we're attempting to reward.
pub async fn no_speedtests(
pool: &PgPool,
reward_period: &Range<DateTime<Utc>>,
Expand All @@ -44,6 +59,10 @@ pub async fn no_speedtests(
Ok(count == 0)
}

/// Unique Connections are submitted once per day,
///
/// We want to make sure we have received a report of unique connections for the
/// period we're attempting to reward.
pub async fn no_unique_connections(
pool: &PgPool,
reward_period: &Range<DateTime<Utc>>,
Expand Down