summaryrefslogtreecommitdiffstats
path: root/src/review/candidates.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/review/candidates.rs')
-rw-r--r--src/review/candidates.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/review/candidates.rs b/src/review/candidates.rs
index 4dc6c4f..566434b 100644
--- a/src/review/candidates.rs
+++ b/src/review/candidates.rs
@@ -142,6 +142,26 @@ impl NewCandidate {
}
}
+/// Every candidate regardless of state, newest first (`aur-build reviews --all`).
+pub fn all_candidates(db: &Db) -> Result<Vec<CandidateRow>> {
+ db.read(|c| {
+ let mut stmt = c.prepare(
+ "SELECT c.id, c.pkgbase_id, c.base_release_id, c.kind, c.snapshot_id, c.epoch, c.pkgver,
+ c.pkgrel, c.upstream_pins_json, c.source_digests_json, c.identity_hash,
+ c.diff_digest, c.revision, c.viewed_at, c.risk_level, c.risk_signals_json,
+ c.missing_deps_json, c.state, c.detected_at, c.resolved_at, b.name
+ FROM candidate c JOIN pkgbase b ON b.id = c.pkgbase_id
+ ORDER BY c.detected_at DESC LIMIT 500",
+ )?;
+ let rows = stmt.query_map([], row_to_candidate)?;
+ let mut out = Vec::new();
+ for r in rows {
+ out.push(r?);
+ }
+ Ok(out)
+ })
+}
+
/// Mark a candidate `viewed` the first time a human opens it. That timestamp is
/// what decides whether a later detection collapses or supersedes (ยง7.1).
pub fn mark_viewed(db: &Db, id: i64) -> Result<()> {