Skip to content

Commit

Permalink
fix db field typo
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldjeffrey committed Nov 5, 2024
1 parent cec9ea0 commit 76450a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions mobile_verifier/migrations/38_radio_location_estimates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS radio_location_estimates (
hex BIGINT NOT NULL,
grid_distance BIGINT NOT NULL,
confidence DECIMAL NOT NULL,
invalided_at TIMESTAMPTZ DEFAULT NULL,
invalidated_at TIMESTAMPTZ DEFAULT NULL,
inserted_at TIMESTAMPTZ DEFAULT now(),
PRIMARY KEY (hashed_key)
);
);
8 changes: 4 additions & 4 deletions mobile_verifier/src/radio_location_estimates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ async fn invalidate_old_estimates(
sqlx::query(
r#"
UPDATE radio_location_estimates
SET invalided_at = now()
SET invalidated_at = now()
WHERE radio_key = $1
AND received_timestamp < $2;
"#,
Expand Down Expand Up @@ -284,8 +284,8 @@ pub async fn clear_invalided(
sqlx::query(
r#"
DELETE FROM radio_location_estimates
WHERE invalided_at IS NOT NULL
AND invalided_at < $1
WHERE invalidated_at IS NOT NULL
AND invalidated_at < $1
"#,
)
.bind(timestamp)
Expand All @@ -305,7 +305,7 @@ pub async fn clear_invalided(
// FROM radio_location_estimates
// WHERE radio_key = $1
// AND confidence >= $2
// AND invalided_at IS NULL
// AND invalidated_at IS NULL
// ORDER BY radius DESC, confidence DESC
// "#,
// )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ fn compare_report_and_estimate(
assert_eq!(report.report.estimates[0].confidence, estimate.confidence);

if should_be_valid {
assert!(estimate.invalided_at.is_none());
assert!(estimate.invalidated_at.is_none());
} else {
assert!(estimate.invalided_at.is_some());
assert!(estimate.invalidated_at.is_some());
}
}

Expand All @@ -204,7 +204,7 @@ pub struct RadioLocationEstimateDB {
pub hex: CellIndex,
pub grid_distance: u32,
pub confidence: rust_decimal::Decimal,
pub invalided_at: Option<DateTime<Utc>>,
pub invalidated_at: Option<DateTime<Utc>>,
}

pub async fn select_radio_location_estimates(
Expand Down Expand Up @@ -232,7 +232,7 @@ pub async fn select_radio_location_estimates(
hex,
grid_distance: row.get::<i64, _>("grid_distance") as u32,
confidence: row.get("confidence"),
invalided_at: row.try_get("invalided_at").ok(),
invalidated_at: row.try_get("invalidated_at").ok(),
}
})
.collect();
Expand Down

0 comments on commit 76450a8

Please sign in to comment.