diff --git a/mobile_verifier/src/boosting_oracles/data_sets.rs b/mobile_verifier/src/boosting_oracles/data_sets.rs index 80ab2b931..a9b080116 100644 --- a/mobile_verifier/src/boosting_oracles/data_sets.rs +++ b/mobile_verifier/src/boosting_oracles/data_sets.rs @@ -520,19 +520,30 @@ pub mod db { pool: &PgPool, period_end: DateTime, ) -> sqlx::Result { - Ok( - sqlx::query_scalar( - "SELECT COUNT(*) > 0 FROM data_sets WHERE time_to_use <= $1 AND status != 'processed'", - ) - .bind(period_end) - .fetch_one(pool) - .await? + Ok(sqlx::query_scalar( + "SELECT COUNT(*) > 0 FROM data_sets WHERE time_to_use <= $1 AND status != 'processed'", + ) + .bind(period_end) + .fetch_one(pool) + .await? || sqlx::query_scalar( - "SELECT COUNT(*) > 0 from hexes where urbanized IS NULL OR footfall IS NULL OR landtype IS NULL" + r#" + SELECT COUNT(*) > 0 FROM coverage_objects + WHERE inserted_at < $1 AND uuid IN ( + SELECT + DISTINCT uuid + FROM + hexes + WHERE + urbanized IS NULL + OR footfall IS NULL + OR landtype IS NULL + ) + "#, ) + .bind(period_end) .fetch_one(pool) - .await? - ) + .await?) } }