fixed up the featured artist thing
This commit is contained in:
+30
-10
@@ -1,6 +1,6 @@
|
||||
use chrono::Utc;
|
||||
use sea_orm::*;
|
||||
use sea_orm::sea_query::Expr;
|
||||
use sea_orm::*;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::entities::work_queue::{
|
||||
@@ -125,7 +125,10 @@ pub async fn reset_stale_running(db: &DatabaseConnection) -> DbResult<u64> {
|
||||
work_queue::Column::Status,
|
||||
Expr::value(WorkQueueStatus::Pending),
|
||||
)
|
||||
.col_expr(work_queue::Column::StartedAt, Expr::value(Option::<chrono::NaiveDateTime>::None))
|
||||
.col_expr(
|
||||
work_queue::Column::StartedAt,
|
||||
Expr::value(Option::<chrono::NaiveDateTime>::None),
|
||||
)
|
||||
.filter(work_queue::Column::Status.eq(WorkQueueStatus::Running))
|
||||
.exec(db)
|
||||
.await?;
|
||||
@@ -172,10 +175,30 @@ pub async fn counts_all(db: &DatabaseConnection) -> DbResult<AllCounts> {
|
||||
let items = WorkQueue::find().all(db).await?;
|
||||
|
||||
let mut result = AllCounts {
|
||||
download: TypeCounts { pending: 0, running: 0, completed: 0, failed: 0 },
|
||||
index: TypeCounts { pending: 0, running: 0, completed: 0, failed: 0 },
|
||||
tag: TypeCounts { pending: 0, running: 0, completed: 0, failed: 0 },
|
||||
organize: TypeCounts { pending: 0, running: 0, completed: 0, failed: 0 },
|
||||
download: TypeCounts {
|
||||
pending: 0,
|
||||
running: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
},
|
||||
index: TypeCounts {
|
||||
pending: 0,
|
||||
running: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
},
|
||||
tag: TypeCounts {
|
||||
pending: 0,
|
||||
running: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
},
|
||||
organize: TypeCounts {
|
||||
pending: 0,
|
||||
running: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
},
|
||||
};
|
||||
|
||||
for item in items {
|
||||
@@ -204,10 +227,7 @@ pub struct AllCounts {
|
||||
}
|
||||
|
||||
/// Check if all items for a pipeline are completed.
|
||||
pub async fn pipeline_is_complete(
|
||||
db: &DatabaseConnection,
|
||||
pipeline_id: &str,
|
||||
) -> DbResult<bool> {
|
||||
pub async fn pipeline_is_complete(db: &DatabaseConnection, pipeline_id: &str) -> DbResult<bool> {
|
||||
let incomplete = WorkQueue::find()
|
||||
.filter(work_queue::Column::PipelineId.eq(pipeline_id))
|
||||
.filter(work_queue::Column::Status.ne(WorkQueueStatus::Completed))
|
||||
|
||||
Reference in New Issue
Block a user