Skip to content

Commit

Permalink
Fix game-level duplication badge fading
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed May 21, 2024
1 parent 5428091 commit 930130a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* For Heroic and Lutris roots,
if you had multiple copies of the same game,
Ludusavi would only use the metadata from one of them.
* GUI: The game-level duplication badge did not always fade out when the conflicts were resolved.

## v0.23.0 (2024-04-27)

Expand Down
12 changes: 9 additions & 3 deletions src/scan/duplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ pub struct DuplicateDetectorEntry {
change: ScanChange,
}

impl DuplicateDetectorEntry {
pub fn is_inert(&self) -> bool {
!self.enabled || self.change.is_inert()
}
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
struct DuplicateDetectorCount {
non_unique: u32,
Expand Down Expand Up @@ -287,15 +293,15 @@ impl DuplicateDetector {
for item in self.files.values() {
if item.contains_key(game) && item.len() > 1 {
tally.non_unique += 1;
if item.values().filter(|x| !x.change.is_inert()).count() <= 1 {
if item.values().filter(|x| !x.is_inert()).count() <= 1 {
tally.resolved += 1;
}
}
}
for item in self.registry.values() {
if item.contains_key(game) && item.len() > 1 {
tally.non_unique += 1;
if item.values().filter(|x| !x.change.is_inert()).count() <= 1 {
if item.values().filter(|x| !x.is_inert()).count() <= 1 {
tally.resolved += 1;
}
}
Expand All @@ -304,7 +310,7 @@ impl DuplicateDetector {
for item in item.values() {
if item.contains_key(game) && item.len() > 1 {
tally.non_unique += 1;
if item.values().filter(|x| !x.change.is_inert()).count() <= 1 {
if item.values().filter(|x| !x.is_inert()).count() <= 1 {
tally.resolved += 1;
}
}
Expand Down

0 comments on commit 930130a

Please # to comment.