Formatting
This commit is contained in:
@@ -5,21 +5,21 @@ use std::time::SystemTime;
|
||||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, Redirect};
|
||||
use time::format_description::well_known::Rfc3339;
|
||||
use time::OffsetDateTime;
|
||||
use time::format_description::well_known::Rfc3339;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tracing::{info, warn};
|
||||
|
||||
use doctate_common::timestamp::{filename_stem_to_recorded_at, now_rfc3339};
|
||||
|
||||
use crate::analyze::{
|
||||
AnalysisInput, AnalyzeJob, AnalyzeSender, RecordingInput, ANALYSIS_INPUT_FILE, DOCUMENT_FILE,
|
||||
ANALYSIS_INPUT_FILE, AnalysisInput, AnalyzeJob, AnalyzeSender, DOCUMENT_FILE, RecordingInput,
|
||||
};
|
||||
use crate::auth::AuthenticatedWebUser;
|
||||
use crate::case_id::CaseIdPath;
|
||||
use crate::config::Config;
|
||||
use crate::error::AppError;
|
||||
use crate::paths::{read_delete_marker, write_delete_marker, DeleteMarker, DELETE_MARKER};
|
||||
use crate::paths::{DELETE_MARKER, DeleteMarker, read_delete_marker, write_delete_marker};
|
||||
use crate::routes::user_web::locate_case_or_404;
|
||||
|
||||
#[derive(Template)]
|
||||
@@ -157,17 +157,13 @@ fn compute_last_mtime(m4as: &[(PathBuf, SystemTime)]) -> SystemTime {
|
||||
/// transkribiert" body. Blank transcripts are silently skipped — they
|
||||
/// represent recordings the transcriber classified as silence and must
|
||||
/// not be pushed to the LLM.
|
||||
async fn read_recordings(
|
||||
m4as: &[(PathBuf, SystemTime)],
|
||||
) -> Result<Vec<RecordingInput>, AppError> {
|
||||
async fn read_recordings(m4as: &[(PathBuf, SystemTime)]) -> Result<Vec<RecordingInput>, AppError> {
|
||||
let mut recordings: Vec<RecordingInput> = Vec::new();
|
||||
for (m4a_path, _) in m4as {
|
||||
let transcript_path = m4a_path.with_extension("transcript.txt");
|
||||
let text = tokio::fs::read_to_string(&transcript_path)
|
||||
.await
|
||||
.map_err(|_| {
|
||||
AppError::BadRequest("Nicht alle Aufnahmen sind transkribiert".into())
|
||||
})?;
|
||||
.map_err(|_| AppError::BadRequest("Nicht alle Aufnahmen sind transkribiert".into()))?;
|
||||
|
||||
if text.trim().is_empty() {
|
||||
continue;
|
||||
@@ -240,7 +236,9 @@ pub(crate) async fn write_input_create_new(
|
||||
|
||||
/// Read `case_dir/document.md`. Returns `None` if no document exists.
|
||||
pub(crate) async fn read_document(case_dir: &Path) -> Option<String> {
|
||||
tokio::fs::read_to_string(case_dir.join(DOCUMENT_FILE)).await.ok()
|
||||
tokio::fs::read_to_string(case_dir.join(DOCUMENT_FILE))
|
||||
.await
|
||||
.ok()
|
||||
}
|
||||
|
||||
/// Reset a case to its raw audio: delete all derived artefacts
|
||||
@@ -388,8 +386,7 @@ async fn latest_delete_batch(user_root: &Path) -> Option<(uuid::Uuid, String)> {
|
||||
None => Some(candidate),
|
||||
// Order: deleted_at desc, then batch desc as tie-breaker.
|
||||
Some(ref cur)
|
||||
if candidate.1 > cur.1
|
||||
|| (candidate.1 == cur.1 && candidate.0 > cur.0) =>
|
||||
if candidate.1 > cur.1 || (candidate.1 == cur.1 && candidate.0 > cur.0) =>
|
||||
{
|
||||
Some(candidate)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user