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.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/review/candidates.rs b/src/review/candidates.rs
index 53361fe..b220013 100644
--- a/src/review/candidates.rs
+++ b/src/review/candidates.rs
@@ -3,9 +3,16 @@ use crate::error::Result;
pub use crate::db::candidates::{
all as all_candidates, by_id as candidate_by_id, mark_viewed, open_reviews_for, pending as pending_candidates,
- reopen_rejected, set_diff_digest, set_missing_deps, set_risk, NewCandidate,
+ reopen_rejected, set_diff_digest, NewCandidate,
};
+/// The risk columns are review's to write, from `intake::record` and nowhere
+/// else. A fixture that needs a particular score says so through this.
+#[cfg(feature = "test-support")]
+pub fn set_risk_for_tests(db: &Db, id: i64, level: &str, signals: &[String]) -> Result<()> {
+ db::candidates::set_risk(db, id, level, signals)
+}
+
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Upsert {
Created { id: i64, kind: String },
@@ -15,7 +22,7 @@ pub enum Upsert {
Unchanged,
}
-pub fn upsert_candidate(db: &Db, pb: &Pkgbase, accepted: Option<&ReleaseRow>, nc: &NewCandidate) -> Result<Upsert> {
+pub(crate) fn upsert_candidate(db: &Db, pb: &Pkgbase, accepted: Option<&ReleaseRow>, nc: &NewCandidate) -> Result<Upsert> {
let kind = if accepted.is_some() { db::candidate_kind::NEW_VERSION } else { db::candidate_kind::FIRST_INTRODUCTION };
let base = accepted.map(|a| a.id);
let pkgbase_id = pb.id;
@@ -45,10 +52,3 @@ pub fn upsert_candidate(db: &Db, pb: &Pkgbase, accepted: Option<&ReleaseRow>, nc
Ok(Upsert::Created { id, kind: kind.to_string() })
})
}
-
-pub fn accepted_for(db: &Db, pb: &Pkgbase) -> Result<Option<ReleaseRow>> {
- match pb.current_accepted_release_id {
- Some(id) => db::release_by_id(db, id),
- None => Ok(None),
- }
-}