diff --git a/.sqlx/query-6b6ca993e9600caf8a4066432a7583be29811979fcfa869677c8dbbe5d19e2a8.json b/.sqlx/query-211337e4e9c9056c653e8e1e8f70384e5a262b9111183394b54c76d9412c72fa.json similarity index 97% rename from .sqlx/query-6b6ca993e9600caf8a4066432a7583be29811979fcfa869677c8dbbe5d19e2a8.json rename to .sqlx/query-211337e4e9c9056c653e8e1e8f70384e5a262b9111183394b54c76d9412c72fa.json index 31e5fb0..b823768 100644 --- a/.sqlx/query-6b6ca993e9600caf8a4066432a7583be29811979fcfa869677c8dbbe5d19e2a8.json +++ b/.sqlx/query-211337e4e9c9056c653e8e1e8f70384e5a262b9111183394b54c76d9412c72fa.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "UPDATE podcast_job SET state = $3, stage = $4, progress = $5, error_code = $6, format = COALESCE(format, $7::text), transcript = COALESCE(transcript, $8::text), sources = COALESCE(sources, $9::jsonb), updated_at = $10 WHERE id = $1 AND state = $2 RETURNING id AS \"id: PodcastJobId\", user_id AS \"user_id: UserId\", source_id, format, transcript, sources AS \"sources: Json\", state AS \"state: PodcastJobState\", stage, progress, error_code, audio_key, audio_name, audio_type, audio_bytes, duration_secs, eta_secs, created_at AS \"created_at: Timestamp\", updated_at AS \"updated_at: Timestamp\"", + "query": "UPDATE podcast_job SET state = $3, stage = $4, progress = $5, error_code = $6, format = COALESCE(format, $7::text), transcript = COALESCE(transcript, $8::text), sources = COALESCE($9::jsonb, sources), updated_at = $10 WHERE id = $1 AND state = $2 RETURNING id AS \"id: PodcastJobId\", user_id AS \"user_id: UserId\", source_id, format, transcript, sources AS \"sources: Json\", state AS \"state: PodcastJobState\", stage, progress, error_code, audio_key, audio_name, audio_type, audio_bytes, duration_secs, eta_secs, created_at AS \"created_at: Timestamp\", updated_at AS \"updated_at: Timestamp\"", "describe": { "columns": [ { @@ -237,5 +237,5 @@ false ] }, - "hash": "6b6ca993e9600caf8a4066432a7583be29811979fcfa869677c8dbbe5d19e2a8" + "hash": "211337e4e9c9056c653e8e1e8f70384e5a262b9111183394b54c76d9412c72fa" } diff --git a/src/db/podcast_job.rs b/src/db/podcast_job.rs index ab6106f..3b61348 100644 --- a/src/db/podcast_job.rs +++ b/src/db/podcast_job.rs @@ -203,7 +203,7 @@ pub async fn report( PodcastJob, "UPDATE podcast_job SET state = $3, stage = $4, progress = $5, error_code = $6, \ format = COALESCE(format, $7::text), transcript = COALESCE(transcript, $8::text), \ - sources = COALESCE(sources, $9::jsonb), updated_at = $10 \ + sources = COALESCE($9::jsonb, sources), updated_at = $10 \ WHERE id = $1 AND state = $2 \ RETURNING id AS \"id: PodcastJobId\", user_id AS \"user_id: UserId\", \ source_id, format, transcript, sources AS \"sources: Json\", state AS \"state: PodcastJobState\", stage, progress, error_code, \ diff --git a/tests/podcast.rs b/tests/podcast.rs index 5cc497e..2619572 100644 --- a/tests/podcast.rs +++ b/tests/podcast.rs @@ -854,14 +854,11 @@ async fn the_result_door_exposes_the_reported_sources() { let (note, _key) = note_with_pdf(&app, &db).await; let job_id = submit_job(&app, &cookie, ¬e).await; - assert_report_stored( - &capability_call( - &service.conn, - report_frame(&job_id, ¬e, &user, "running", "tts", 0.25), - ) - .await, - &job_id, - ); + let mut running = report_frame(&job_id, ¬e, &user, "running", "tts", 0.25); + running["payload"]["sources"] = json!([ + { "key": "019732e3-7b00-7000-8000-00000000beef", "name": "tanim.pdf", "status": "pending" }, + ]); + assert_report_stored(&capability_call(&service.conn, running).await, &job_id); let bytes = episode_bytes(); let answer = blob_upload(