Added features to hide individual items from Home and toggle Special Episodes visibility#1193
Added features to hide individual items from Home and toggle Special Episodes visibility#1193kuzhagan143 wants to merge 4 commits intoFuzzyGrim:devfrom
Conversation
…Episodes visibility This PR introduces two new filtering features for the Home page "In Progress" section. Features: Hide Items from Home: Users can now hide specific media items from their "In Progress" list on the Home page. Added a "Hidden" filter option to the sort dropdown (visible only when hidden items exist). Hidden items can be viewed and individually restored via a new "Unhide" button (green eye icon). Special Episodes Toggle: Added a user preference to show/hide "Special Episodes" (Season 0) from the "In Progress" list. Controlled via Settings -> Preferences -> Show Special Episodes in In Progress. Default is enabled (current behavior).
Summary of ChangesHello @kuzhagan143, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience on the Home page by providing more granular control over the displayed 'In Progress' media. Users can now personalize their view by hiding individual items and toggling the visibility of special episodes. These changes are supported by backend model updates and frontend UI adjustments, making the home feed more customizable and relevant to individual preferences. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This PR introduces two useful filtering features on the home page: hiding individual items and toggling the visibility of special episodes. The implementation is quite extensive, touching many parts of the application from models and views to templates and helpers. The changes are mostly well-contained and logical.
I've identified a few areas for improvement, including a critical bug in the IGDB provider, a performance issue in the home page view, and a potential regression in the Steam import error handling. I've also left a couple of suggestions for improving UI and code cleanliness. Overall, a solid contribution with some important fixes needed.
| "POST", | ||
| url, | ||
| data=multiquery, | ||
| data=data, |
There was a problem hiding this comment.
There seems to be a copy-paste error here. The variable data is used, but it's not defined in this except block. The original query is stored in the multiquery variable. Using data here will raise a NameError when this retry logic is triggered. You should use multiquery instead.
| data=data, | |
| data=multiquery, |
src/app/views.py
Outdated
| if show_hidden: | ||
| # Show only hidden items: fetch all in-progress, keep only hidden ones | ||
| list_by_type = BasicMedia.objects.get_in_progress( | ||
| request.user, | ||
| sort_by, | ||
| None, | ||
| media_type_to_load, | ||
| ) | ||
|
|
||
| for media_type in list(list_by_type.keys()): | ||
| items = list_by_type[media_type]["items"] | ||
| hidden_items = [m for m in items if m.item_id in hidden_item_ids] | ||
| if hidden_items: | ||
| list_by_type[media_type]["items"] = hidden_items | ||
| list_by_type[media_type]["total"] = len(hidden_items) | ||
| else: | ||
| del list_by_type[media_type] | ||
|
|
||
| else: | ||
| # Normal in-progress view | ||
| list_by_type = BasicMedia.objects.get_in_progress( | ||
| request.user, | ||
| sort_by, | ||
| items_limit, | ||
| media_type_to_load, | ||
| ) | ||
|
|
||
| # Filter out hidden items | ||
| if hidden_item_ids: | ||
| for media_type in list(list_by_type.keys()): | ||
| original_items = list_by_type[media_type]["items"] | ||
| filtered_items = [ | ||
| m for m in original_items if m.item_id not in hidden_item_ids | ||
| ] | ||
| list_by_type[media_type]["items"] = filtered_items | ||
| # Remove empty sections | ||
| if not filtered_items and not media_type_to_load: | ||
| del list_by_type[media_type] | ||
|
|
There was a problem hiding this comment.
The current implementation for filtering hidden items has a couple of issues:
- Inefficiency: When
show_hiddenis true, it fetches all in-progress items from the database and then filters them in Python. This can be very inefficient if there are many in-progress items but few hidden ones. A better approach would be to filter in the database directly. - Incorrect item count: When
show_hiddenis false, it fetches a limited number of items and then filters out hidden ones. This can result in fewer items being displayed thanitems_limit, which might not be the desired user experience.
I suggest refactoring this logic to perform filtering at the database level. This would improve performance and ensure the correct number of items is displayed. You could achieve this by modifying BasicMedia.objects.get_in_progress to accept a list of item IDs to include or exclude.
src/integrations/imports/steam.py
Outdated
| "title": game_details.get("title", game_name), | ||
| "image": game_details["image"], | ||
| } | ||
| except (ValueError, KeyError, TypeError) as e: |
There was a problem hiding this comment.
The try...except block in _match_with_igdb only catches (ValueError, KeyError, TypeError). However, the call to services.get_media_metadata within the try block can raise a services.ProviderAPIError, for example if the game is not found on IGDB. This exception is not caught here, which could cause the entire Steam import to fail if a single game lookup fails.
The previous implementation handled this by catching ProviderAPIError in _process_game. I recommend adding services.ProviderAPIError to this except block to make the import more resilient to failures with individual games.
| except (ValueError, KeyError, TypeError) as e: | |
| except (ValueError, KeyError, TypeError, services.ProviderAPIError) as e: |
|
|
||
| # Database | ||
| db/*.sqlite3 | ||
| db/db.sqlite3 |
src/templates/users/import_data.html
Outdated
| {% endif %} | ||
|
|
||
| <div class="mt-2 space-y-1 text-sm bg-[#2a2f35] p-3 rounded overflow-x-auto break-words" | ||
| <div class="mt-2 space-y-1 text-sm bg-[#2a2f35] p-3 rounded" |
There was a problem hiding this comment.
The overflow-x-auto class was removed from this div, which is used to display import errors and tracebacks. Tracebacks can contain very long lines that don't wrap automatically. Without overflow-x-auto, these long lines could break the layout of the page.
I recommend adding overflow-x-auto back to ensure that long error messages are scrollable horizontally and don't disrupt the UI.
<div class="mt-2 space-y-1 text-sm bg-[#2a2f35] p-3 rounded overflow-x-auto"
Extend MediaManager to accept include_item_ids and exclude_item_ids (get_media_list and get_in_progress) and apply those as DB-level filters. Update home view to use these DB filters for showing/excluding hidden items (removing costly post-query Python filtering). Catch services.ProviderAPIError in the Steam importer to avoid unhandled provider errors. Add compiled Tailwind CSS asset, remove obsolete static/js and SVG, update import_data template, and add/replace user migration files for new display preferences.
|
Thank you for the pull requests! However, it's very difficult to review this: https://github.com/FuzzyGrim/Yamtrack/pull/1193/changes You've modified 111 files, most of which are unrelated to your features. Please try creating new pull requests with only the changes you want. I also suggest splitting the two features into separate pull requests. |
This PR introduces two new filtering features for the Home page "In Progress" section.
Features:
Hide Items from Home:
Users can now hide specific media items from their "In Progress" list on the Home page.
Added a "Hidden" filter option to the sort dropdown (visible only when hidden items exist).
Hidden items can be viewed and individually restored via a new "Unhide" button (green eye icon).
Special Episodes Toggle:
Added a user preference to show/hide "Special Episodes" (Season 0) from the "In Progress" list.
Controlled via Settings -> Preferences -> Show Special Episodes in In Progress.
Default is enabled (current behavior).
Closes #732