Skip to content

Commit

Permalink
fix: use installed data for title & author
Browse files Browse the repository at this point in the history
Signed-off-by: arcanist <arcanistzed@gmail.com>
  • Loading branch information
arcanistzed committed Aug 29, 2022
1 parent ff1b566 commit a035046
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/controller/SpreadsheetController.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ export default class SpreadsheetController {
* @returns {RowData} The row of compatibility data
*/
static lookupCompatibility(spreadsheet, module) {
// Get fallback
// Get installed data
const {
title,
type = "module",
authors: [{ name: authorName = "" } = {}],
compatibleCoreVersion,
compatibility: { verified = null } = {},
} = module.data;
const fallback = {
const installed = {
title: title ?? localize("mcc.untitled"),
type,
id: module.id ?? module.name,
Expand All @@ -101,12 +101,17 @@ export default class SpreadsheetController {

// Merge data
for (const property in data) {
// Use the latest of the version numbers
if (property === "version") {
data.version = foundry.utils.isNewerVersion(data.version, fallback.version) ? data.version : fallback.version;
data.version = foundry.utils.isNewerVersion(data.version, installed.version) ? data.version : installed.version;
}
if (data[property] === undefined) {
if (!["status", "notes"].includes(property)) data.official = false;
data[property] = fallback[property];
// Mark the package as non-official if there is no status or notes
if (!["status", "notes"].includes(property)) {
data.official = false;
}
// Use the spreadsheet data for the title, author, or if there is no spreadsheet data for this property
if (["title", "author"].includes(property) || data[property] === undefined) {
data[property] = installed[property];
}
}

Expand Down

0 comments on commit a035046

Please sign in to comment.