diff --git a/backend/exceptions/endpoint_exceptions.py b/backend/exceptions/endpoint_exceptions.py index a2d206739..473d0d21e 100644 --- a/backend/exceptions/endpoint_exceptions.py +++ b/backend/exceptions/endpoint_exceptions.py @@ -7,9 +7,7 @@ class PlatformNotFoundInDatabaseException(Exception): self.message = f"Platform with id '{id}' not found" super().__init__(self.message) log.critical(self.message) - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=self.message - ) + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=self.message) def __repr__(self) -> str: return self.message @@ -20,9 +18,7 @@ class RomNotFoundInDatabaseException(Exception): self.message = f"Rom with id '{id}' not found" super().__init__(self.message) log.critical(self.message) - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=self.message - ) + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=self.message) def __repr__(self) -> str: return self.message diff --git a/frontend/src/components/Details/Info/FileInfo.vue b/frontend/src/components/Details/Info/FileInfo.vue index 05cca08ac..ac34f3c49 100644 --- a/frontend/src/components/Details/Info/FileInfo.vue +++ b/frontend/src/components/Details/Info/FileInfo.vue @@ -12,7 +12,7 @@ import { ref, watch } from "vue"; const props = defineProps<{ rom: DetailedRom; platform: Platform }>(); const downloadStore = storeDownload(); const auth = storeAuth(); -const ownProps = ref( +const romUser = ref( props.rom.rom_user ?? { id: null, user_id: auth.user?.id, diff --git a/frontend/src/components/Details/Saves.vue b/frontend/src/components/Details/Saves.vue index 2b850f7b1..585d326b7 100644 --- a/frontend/src/components/Details/Saves.vue +++ b/frontend/src/components/Details/Saves.vue @@ -13,7 +13,6 @@ const { xs, smAndUp, mdAndUp } = useDisplay(); const props = defineProps<{ rom: DetailedRom }>(); const selectedSaves = ref([]); const emitter = inject>("emitter"); -// emitter?.on("romUpdated", (romUpdated) => {}); const HEADERS = [ { title: "Name", diff --git a/frontend/src/services/api/rom.ts b/frontend/src/services/api/rom.ts index 3b855c28c..fa6383ee4 100644 --- a/frontend/src/services/api/rom.ts +++ b/frontend/src/services/api/rom.ts @@ -136,8 +136,6 @@ async function updateRom({ const formData = new FormData(); if (rom.igdb_id) formData.append("igdb_id", rom.igdb_id.toString()); if (rom.moby_id) formData.append("moby_id", rom.moby_id.toString()); - // if (rom.fav_sibling) - // formData.append("fav_sibling", rom.fav_sibling.toString()); formData.append("name", rom.name || ""); formData.append("file_name", rom.file_name); formData.append("summary", rom.summary || ""); diff --git a/frontend/src/stores/roms.ts b/frontend/src/stores/roms.ts index 53386e0bc..776c385fc 100644 --- a/frontend/src/stores/roms.ts +++ b/frontend/src/stores/roms.ts @@ -63,9 +63,17 @@ export default defineStore("roms", { ), ) .map((games) => { + // Find the index of the game where the 'rom_user' property has 'is_main_sibling' set to true. + // If such a game is found, 'mainSiblingIndex' will be its index, otherwise it will be -1. const mainSiblingIndex = games.findIndex( (game) => game.rom_user?.is_main_sibling, ); + + // Determine the primary game: + // - If 'mainSiblingIndex' is not -1 (i.e., a main sibling game was found), + // remove that game from the 'games' array and set it as 'primaryGame'. + // - If no main sibling game was found ('mainSiblingIndex' is -1), + // remove the first game from the 'games' array and set it as 'primaryGame'. const primaryGame = mainSiblingIndex !== -1 ? games.splice(mainSiblingIndex, 1)[0]