Skip to content

Commit 2b16e8a

Browse files
committed
Make filtering better
1 parent 59d5e8f commit 2b16e8a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/SearchHistory.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,23 @@ bool SearchHistoryObject::operator==(const SearchHistoryObject& other) const {
4747
bool SearchHistoryObject::contains(const SearchHistoryObject& other) const {
4848
if (other.type > -1 && type != other.type) return false;
4949
if (!other.query.empty() && !string::toLower(query).contains(string::toLower(other.query))) return false;
50-
if (type >= 2) return true;
50+
if (type >= 2) {
51+
if (!other.difficulties.empty() || !other.lengths.empty()) return false;
52+
if (other.uncompleted) return false;
53+
if (other.completed) return false;
54+
if (other.featured) return false;
55+
if (other.original) return false;
56+
if (other.twoPlayer) return false;
57+
if (other.coins) return false;
58+
if (other.epic) return false;
59+
if (other.legendary) return false;
60+
if (other.mythic) return false;
61+
if (other.song) return false;
62+
if (other.noStar) return false;
63+
if (other.star) return false;
64+
if (other.demonFilter > 0) return false;
65+
return true;
66+
}
5167
for (auto diff : other.difficulties) {
5268
if (!std::ranges::contains(difficulties, diff)) return false;
5369
}
@@ -71,6 +87,20 @@ bool SearchHistoryObject::contains(const SearchHistoryObject& other) const {
7187
}
7288
if (other.noStar && !noStar) return false;
7389
}
90+
else {
91+
if (!other.lengths.empty()) return false;
92+
if (other.uncompleted) return false;
93+
if (other.completed) return false;
94+
if (other.featured) return false;
95+
if (other.original) return false;
96+
if (other.twoPlayer) return false;
97+
if (other.coins) return false;
98+
if (other.epic) return false;
99+
if (other.legendary) return false;
100+
if (other.mythic) return false;
101+
if (other.song) return false;
102+
if (other.noStar) return false;
103+
}
74104
if (other.demonFilter > 0 && demonFilter != other.demonFilter) return false;
75105
if (other.star && !star) return false;
76106
return true;

0 commit comments

Comments
 (0)