Filtering out sibling ROMs from showing during scans#93
Filtering out sibling ROMs from showing during scans#93OctoLiam wants to merge 1 commit intorommapp:mainfrom
Conversation
- Updated RomM.cs to utilize the new method for ROM siblings to allow the skipping of ROM siblings when necessary. modified: Models/RomM/Rom/RomMRom.cs modified: RomM.cs
Summary of ChangesHello @OctoLiam, 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 introduces functionality to intelligently filter out sibling ROMs during game scans. By enhancing the ROM data model to include sibling relationships and implementing new logic, the system can now identify and exclude redundant ROM entries, leading to cleaner and more accurate scan results, addressing the goals of issue #91. 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 pull request introduces a mechanism to filter out sibling ROMs during library scans. It adds a Siblings property to the RomMRom model and logic in RomM.cs to process these siblings. The logic correctly identifies sibling groups and filters them based on whether a 'main' sibling is designated. I've provided a suggestion to refactor a part of the filtering logic to improve its clarity and conciseness.
| var mainSiblingId = item.Siblings.FirstOrDefault(s => s.IsMainSibling)?.Id; | ||
|
|
||
| if (mainSiblingId.HasValue) | ||
| { | ||
| foreach (var sibling in item.Siblings.Where(s => !s.IsMainSibling)) | ||
| { | ||
| siblingIdsToSkip.Add(sibling.Id); | ||
| } | ||
| siblingIdsToSkip.Add(item.Id); | ||
| } | ||
| else | ||
| { | ||
| foreach (var sibling in item.Siblings) | ||
| { | ||
| siblingIdsToSkip.Add(sibling.Id); | ||
| } | ||
| } |
There was a problem hiding this comment.
This block of code for determining which sibling ROMs to skip can be simplified for better readability and conciseness. You can determine which ROM ID to keep (either the mainSibling or the current item) and then add all other ROMs from the group to the siblingIdsToSkip set. This also replaces the foreach loops with the more performant UnionWith method on the HashSet.
var mainSibling = item.Siblings.FirstOrDefault(s => s.IsMainSibling);
var idToKeep = mainSibling?.Id ?? item.Id;
groupRomIds.Remove(idToKeep);
siblingIdsToSkip.UnionWith(groupRomIds);
Hopefully this will be a start at working towards #91.
Updated Models/RomM/Rom/RomMRom.cs to include grabbing the siblings of ROMs and a new class of RomMSibling
Updated RomM.cs to utilize the new method for ROM siblings to allow the skipping of ROM siblings when necessary.
modified: Models/RomM/Rom/RomMRom.cs
modified: RomM.cs