Merge remote-tracking branch 'origin/master' into feature/collections

This commit is contained in:
Zurdi
2024-07-02 17:53:35 +02:00
5 changed files with 11 additions and 10 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -13,7 +13,6 @@ const { xs, smAndUp, mdAndUp } = useDisplay();
const props = defineProps<{ rom: DetailedRom }>();
const selectedSaves = ref<SaveSchema[]>([]);
const emitter = inject<Emitter<Events>>("emitter");
// emitter?.on("romUpdated", (romUpdated) => {});
const HEADERS = [
{
title: "Name",

View File

@@ -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 || "");

View File

@@ -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]