Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve Locked State for Artifacts #2575

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libs/gi/db/src/Database/DataManagers/ArtifactDataManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export class ArtifactDataManager extends DataManager<
result.artifacts.import = artifacts.length
const idsToRemove = new Set(this.values.map((a) => a.id))
const hasEquipment = artifacts.some((a) => a.location)
const hasLock = artifacts.some((a) => a.lock)
artifacts.forEach((a): void => {
const art = this.validate(a)
if (!art) {
Expand Down Expand Up @@ -215,6 +216,8 @@ export class ArtifactDataManager extends DataManager<
importArt = {
...art,
location: hasEquipment ? art.location : match.location,
// Preserve existing lock state for artifacts reported as unlocked or when the scanner doesn't detect locks ("lock": false JSON)
lock: hasLock ? art.lock : match.lock,
}
}
}
Expand Down
Loading