Convert scraped movie create data (#832)

This commit is contained in:
WithoutPants 2020-10-09 11:43:54 +11:00 committed by GitHub
parent 94dc74f4a8
commit c3a7d30a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -11,6 +11,7 @@
* Re-show preview thumbnail when mousing away from scene card.
### 🐛 Bug fixes
* Fix error when creating movie from scene scrape dialog.
* Fix incorrect date timezone.
* Fix search filters not persisting for studios, markers and galleries.
* Fix pending thumbnail on wall items on mobile platforms.

View File

@ -18,6 +18,7 @@ import {
useTagCreate,
} from "src/core/StashService";
import { useToast } from "src/hooks";
import { DurationUtils } from "src/utils";
function renderScrapedStudio(
result: ScrapeResult<string>,
@ -395,6 +396,20 @@ export const SceneScrapeDialog: React.FC<ISceneScrapeDialogProps> = (
let movieInput: GQL.MovieCreateInput = { name: "" };
try {
movieInput = Object.assign(movieInput, toCreate);
// #788 - convert duration and rating to the correct type
movieInput.duration = DurationUtils.stringToSeconds(
toCreate.duration ?? undefined
);
if (!movieInput.duration) {
movieInput.duration = undefined;
}
movieInput.rating = parseInt(toCreate.rating ?? "0", 10);
if (!movieInput.rating || Number.isNaN(movieInput.rating)) {
movieInput.rating = undefined;
}
const result = await createMovie({
variables: movieInput,
});