Add oneliner to case view
Introduce an `oneliner` field to the `CaseView` struct and update the `scan_cases` function to read it from `oneliner.txt`. The `cases.html` template is updated to display the oneliner if present. A new integration test is added to verify the functionality.
This commit is contained in:
@@ -22,6 +22,7 @@ struct CaseView {
|
||||
case_id_short: String,
|
||||
status: String,
|
||||
most_recent: String,
|
||||
oneliner: Option<String>,
|
||||
recordings: Vec<RecordingView>,
|
||||
}
|
||||
|
||||
@@ -141,6 +142,11 @@ async fn scan_cases(data_path: &Path) -> Vec<CaseView> {
|
||||
.map(|r| r.filename.clone())
|
||||
.unwrap_or_default();
|
||||
let case_id_short = case_id.chars().take(8).collect();
|
||||
let oneliner = tokio::fs::read_to_string(case_entry.path().join("oneliner.txt"))
|
||||
.await
|
||||
.ok()
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty());
|
||||
|
||||
cases.push(CaseView {
|
||||
user_slug: user_slug.clone(),
|
||||
@@ -148,6 +154,7 @@ async fn scan_cases(data_path: &Path) -> Vec<CaseView> {
|
||||
case_id_short,
|
||||
status: status.to_string(),
|
||||
most_recent,
|
||||
oneliner,
|
||||
recordings,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user