Skip to content

Commit

Permalink
fix: Tag and Platform alias loading
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 committed Apr 2, 2024
1 parent 6ff147f commit 9dcdd3d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 35 deletions.
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-solid-svg-icons": "5.15.4",
"@fortawesome/react-fontawesome": "0.1.18",
"@fparchive/flashpoint-archive": "0.7.9",
"@fparchive/flashpoint-archive": "0.7.10",
"@types/react-virtualized": "^9.21.21",
"axios": "1.6.7",
"connected-react-router": "6.9.2",
Expand Down
22 changes: 13 additions & 9 deletions src/back/curate/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,20 @@ async function getTagsFromStr(tagsStr: string, tagCategoriesStr: string): Promis
const trimmedName = tagName.trim();
const category = splitCategories.length > index ? splitCategories[index].trim() : undefined;
if (trimmedName !== '' && trimmedName !== '[object Object]') {
let tag = await fpDatabase.findTag(trimmedName);
if (!tag) {
// Tag doesn't exist, make a new one
tag = await fpDatabase.createTag(trimmedName, category);
}
if (tag !== null) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (tags.findIndex(t => t.id === tag!.id) === -1) {
tags.push(tag);
try {
let tag = await fpDatabase.findTag(trimmedName);
if (!tag) {
// Tag doesn't exist, make a new one
tag = await fpDatabase.createTag(trimmedName, category);
}
if (tag !== null) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (tags.findIndex(t => t.id === tag!.id) === -1) {
tags.push(tag);
}
}
} catch (error) {
log.error('Launcher', `Unknown Curation Error loading Tag - ${trimmedName} - ${error}`);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/curate/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export function curateStateReducer(state: CurateState = createInitialState(), ac
curation.game.primaryPlatform = action.platform.name;
if (action.platformAppPaths) {
// Find best app path
if (curation.game.primaryPlatform in action.platformAppPaths) {
if (curation.game.primaryPlatform in action.platformAppPaths && action.platformAppPaths[curation.game.primaryPlatform].length > 0) {
curation.game.applicationPath = action.platformAppPaths[curation.game.primaryPlatform][0].appPath;
}
}
Expand Down

0 comments on commit 9dcdd3d

Please sign in to comment.