Skip to content

Commit

Permalink
Fix false positive mismatch in Movie Scrape dialog
Browse files Browse the repository at this point in the history
Scraping a movie by URL would show a difference in duration because the
persisted value of duration was converted to HH:MM:SS while the newly
scraped value was displayed without formatting: this makes sense because
the newly scraped value is just a string and so could be anything

This adds a check to see if the string is a number and converts it to
HH:MM:SS format if possible
  • Loading branch information
Maista6969 committed Sep 22, 2023
1 parent 0b7dcbe commit 4a77437
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export const MovieScrapeDialog: React.FC<IMovieScrapeDialogProps> = (
const [duration, setDuration] = useState<ScrapeResult<string>>(
new ScrapeResult<string>(
DurationUtils.secondsToString(props.movie.duration || 0),
props.scraped.duration
props.scraped.duration && !isNaN(+props.scraped.duration)
? DurationUtils.secondsToString(parseInt(props.scraped.duration, 10))
: undefined
)
);
const [date, setDate] = useState<ScrapeResult<string>>(
Expand Down

0 comments on commit 4a77437

Please sign in to comment.