[16] Fixes #2034 anilist_userlist score attribute wasn't being validated correctly

This commit is contained in:
meisnate12 2024-05-16 09:29:20 -04:00
parent aed98d5c3f
commit d0b6b3abc3
4 changed files with 5 additions and 4 deletions

View file

@ -12,5 +12,6 @@ Changed the `overlay_artwork_filetype` Setting to accept `webp_lossy` and `webp_
# Defaults
# Bug Fixes
Fixes #2034 `anilist_userlist` `score` attribute wasn't being validated correctly
Various other Minor Fixes

View file

@ -1 +1 @@
2.0.1-develop15
2.0.1-develop16

View file

@ -241,7 +241,7 @@ class AniList:
variables = {"user": username, "sort": userlist_sort_options[sort_by]}
for alist in self._request(query, variables)["data"]["MediaListCollection"]["lists"]:
if alist["name"] == list_name:
return [m["media"]["id"] for m in alist["entries"] if not score or not any([util.is_number_filter(value, mod, m["score"]) for mod, value in score.items()])]
return [m["media"]["id"] for m in alist["entries"] if not score or not any([util.is_number_filter(m["score"], mod, value) for mod, value in score.items()])]
return []
def validate_userlist(self, data):

View file

@ -1412,8 +1412,8 @@ class CollectionBuilder:
score_dict = {}
for search_method, search_data in dict_data.items():
search_attr, modifier = os.path.splitext(str(search_method).lower())
if search_attr == "score" and modifier in ["gt", "gte", "lt", "lte"]:
score = util.parse(self.Type, search_method, dict_data, datatype="int", default=-1, minimum=0, maximum=10, parent=method_name)
if search_attr == "score" and modifier in [".gt", ".gte", ".lt", ".lte"]:
score = util.parse(self.Type, search_method, dict_data, methods=dict_methods, datatype="int", default=-1, minimum=0, maximum=10, parent=method_name)
if score > -1:
score_dict[modifier] = score
elif search_attr not in ["username", "list_name", "sort_by"]: