fix(watchlist): strip surrounding quotes from prev user fields (notion_url round-trip)
This commit is contained in:
parent
eeaa37469c
commit
e8cb9b93fe
3 changed files with 16 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import type { WatchlistRecord } from 'packages/obsidian/src/watchlist/schema';
|
||||
import { stripQuotes } from 'packages/obsidian/src/watchlist/parse';
|
||||
|
||||
export type TmdbDetail = Record<string, any>;
|
||||
|
||||
|
|
@ -136,10 +137,10 @@ export function buildRecord(details: TmdbDetail, isMovie: boolean, prev: Record<
|
|||
}
|
||||
|
||||
// ---- preserve user-managed fields ----
|
||||
let watchStatus = prev['watch_status'] || 'Unwatched';
|
||||
const rating = prev['rating'] || '0';
|
||||
const ratingStars = prev['rating_stars'] ?? '';
|
||||
const rawNotionUrl = prev['notion_url'] || '';
|
||||
let watchStatus = stripQuotes(prev['watch_status']) || 'Unwatched';
|
||||
const rating = stripQuotes(prev['rating']) || '0';
|
||||
const ratingStars = stripQuotes(prev['rating_stars']);
|
||||
const rawNotionUrl = stripQuotes(prev['notion_url']);
|
||||
const notionUrl = rawNotionUrl === 'null' ? '' : rawNotionUrl; // quotedOrNull renders empty as literal `null` — don't round-trip it as a value
|
||||
|
||||
// ---- TV watch-status rule: new episode aired since last sync ----
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export function extractMyNotes(body: string): string {
|
|||
return m ? m[1].trim() : '';
|
||||
}
|
||||
|
||||
function stripQuotes(s: string | undefined): string {
|
||||
export function stripQuotes(s: string | undefined): string {
|
||||
return (s ?? '').trim().replace(/^"|"$/g, '');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue