fix(webui): diambiguate fish names #705

Merged
Sainan merged 1 commits from fish-names into main 2025-01-04 17:43:22 -08:00
Owner

Fixes #703

Fixes #703
coderabbitai[bot] commented 2025-01-03 15:36:32 -08:00 (Migrated from github.com)
Author
Owner

Walkthrough

The pull request introduces two primary changes. First, in the package.json file, the dependency warframe-public-export-plus is updated from version ^0.5.18 to ^0.5.19. Second, in the getItemListsController.ts file, a new logic block is added to handle the processing of fish items from ExportResources. The modification specifically targets how fish names are constructed, introducing logic to append size-specific suffixes (Small/Medium/Large) based on the item's uniqueName when dissectionParts are present. This change aims to improve the representation of fish items in the application's item list.

Assessment against linked issues

Objective Addressed Explanation
Fish items should display with size suffixes [#703]
Prevent duplicate fish listings [#703] Unable to definitively confirm from code changes alone

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough The pull request introduces two primary changes. First, in the `package.json` file, the dependency `warframe-public-export-plus` is updated from version `^0.5.18` to `^0.5.19`. Second, in the `getItemListsController.ts` file, a new logic block is added to handle the processing of fish items from `ExportResources`. The modification specifically targets how fish names are constructed, introducing logic to append size-specific suffixes (Small/Medium/Large) based on the item's `uniqueName` when `dissectionParts` are present. This change aims to improve the representation of fish items in the application's item list. ## Assessment against linked issues | Objective | Addressed | Explanation | |-----------|-----------|-------------| | Fish items should display with size suffixes [#703] | ✅ | | | Prevent duplicate fish listings [#703] | ❓ | Unable to definitively confirm from code changes alone | <!-- walkthrough_end --> <!-- internal state start --> <!-- FAHghAtBAEAqAWBLAztF0CGA7TBXALgPYQDmAplmQE4b5kAm0AxoQLasX4Bc0ADldEIAjAFZkm+RADcyqIQE9mhetQxChifADoMiaFAB8wY+CjGAxOegAFAErQAyrnYYq84wjJ9cAGx/QqMgBHXFl8aEl8HwZoACIAM0QADwAKAHcyIVxEAEoeehQMVg0SXFovROR4aCwi2VjoNIxUZFwhVk06RgUI+C9cZGpHXVqcbEZ0RBUsSUSY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IJibS0r0/7caBEzrjNQt6FwXNoFYZQHVjflIceALHMt62Yrt3FkCdg3CCNqhetwHbU4Vxztd1/WXaLt2TbVXE2G7MgrZt3PHed13qA95BluUmoyEY5rVWEkr0Ky4jnnzByKAy60DRZXM8r1ErNBi1A+rYQaAFF2pR2xZCLHXZAH2dxGTpgMD8eQpQC/TMveLApCLmQDTpMgIZKjBoCke01C+Ucv6MgM04QymftjG+iAABeMRQzQgNK8Xw4QQKZzbg4F2zoUgb1YFoEBUpYZ6hyAPIEPhCA9iYMqHAsJxDCXeFCXYuCnqgk5A8ZkhZyoo2qgUPMEh3rWFcHdAeKko7hHoIQPaTkQFeX/vsQBU8ya2Sgo8TkcpcDIl/uQ6+ZI4GMGDG6YcsNFAEMaGGbypwywCAwPQEQZtaJ3UzJOYCOA0h9CsU5MuiBUzzjqF5WuIxUCxFrK4cgsQpSxAALIMEQM4cJggBCUDDNQKUbjyTVETiZHG7Cvh1Chmo7qyI8pwMwOoQIbJ4bZhYFQAoeoqQJgqJyG+g0ZEajLFZQYjInIdFpLg5AWgThVC8hwaEygUS4i/sBRhXh+BkDZEWVABRAghR0f4WaltMH7D1Dgm2+C6iEPhCQhMsow6YB8OaVA8BRR+jqAja0KMRhYikqceO+Inq4ioHHKC4xDGkgwPIDkEYnnnA+m5CwoNzmQXeg8ByAUVB2jegKBGSMOoxDRgzckmNIjZN/NAecDkb7g1TjC6GCLKkgRRSjNFAgxZUK9JIWQhpAgJxsWC72v4+ICUAo9ECpEwIByojEGisEAgYEYsHVitoOKYQ0NxXCnL8LQQ6PgAA+lMZAKryk4wyPQFVuIhG8X4oqpgQgABMKxbIABZLUrBWKa6+pqhCWowJNS1C1TUbD+JsSa7qv4ADZ6B+rIH8DYQgVh/FNYarlSrNBqvoBqrVw8GAqqAoaoAA=== --> <!-- internal state end --> <!-- tips_start --> --- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. ([Beta](https://docs.coderabbit.ai/early-access#beta)) - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2025-01-03 15:38:26 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment
Author
Owner

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/controllers/custom/getItemListsController.ts (1)

40-50: Consider extracting fish name logic into a reusable helper.

This block correctly adjusts fish names by injecting size abbreviations, but it has repetitive string splitting across several branches. To streamline, you could factor out this logic into a helper function or dictionary-based approach to reduce duplication and make future updates simpler.

For instance:

- if ("dissectionParts" in item) {
-   name = getString("/Lotus/Language/Fish/FishDisplayName", lang)
-     .split("|FISH_NAME|").join(name);
-   if (uniqueName.indexOf("Large") != -1) {
-     name = name
-       .split("|FISH_SIZE|")
-       .join(getString("/Lotus/Language/Fish/FishSizeLargeAbbrev", lang));
-   } else if (uniqueName.indexOf("Medium") != -1) {
-     name = name
-       .split("|FISH_SIZE|")
-       .join(getString("/Lotus/Language/Fish/FishSizeMediumAbbrev", lang));
-   } else {
-     name = name
-       .split("|FISH_SIZE|")
-       .join(getString("/Lotus/Language/Fish/FishSizeSmallAbbrev", lang));
-   }
- }

+ const fishSizes = {
+   Large: "/Lotus/Language/Fish/FishSizeLargeAbbrev",
+   Medium: "/Lotus/Language/Fish/FishSizeMediumAbbrev",
+   Small: "/Lotus/Language/Fish/FishSizeSmallAbbrev",
+ };
+
+ if ("dissectionParts" in item) {
+   const fishDisplayName = getString("/Lotus/Language/Fish/FishDisplayName", lang);
+   let fishSizeKey = "Small"; // default
+   if (uniqueName.includes("Large")) fishSizeKey = "Large";
+   else if (uniqueName.includes("Medium")) fishSizeKey = "Medium";
+
+   name = fishDisplayName
+     .replace("|FISH_NAME|", name)
+     .replace("|FISH_SIZE|", getString(fishSizes[fishSizeKey], lang));
+ }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e77f8b0e51 and cb27da4477.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/controllers/custom/getItemListsController.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
🔇 Additional comments (1)
src/controllers/custom/getItemListsController.ts (1)

53-53: Properly uses the preprocessed name.

Switching from getString(item.name, lang) to the name variable ensures the fish-specific adjustments are retained. This is consistent with the new logic and looks good.

**Actionable comments posted: 0** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>src/controllers/custom/getItemListsController.ts (1)</summary><blockquote> `40-50`: **Consider extracting fish name logic into a reusable helper.** This block correctly adjusts fish names by injecting size abbreviations, but it has repetitive string splitting across several branches. To streamline, you could factor out this logic into a helper function or dictionary-based approach to reduce duplication and make future updates simpler. For instance: ```diff - if ("dissectionParts" in item) { - name = getString("/Lotus/Language/Fish/FishDisplayName", lang) - .split("|FISH_NAME|").join(name); - if (uniqueName.indexOf("Large") != -1) { - name = name - .split("|FISH_SIZE|") - .join(getString("/Lotus/Language/Fish/FishSizeLargeAbbrev", lang)); - } else if (uniqueName.indexOf("Medium") != -1) { - name = name - .split("|FISH_SIZE|") - .join(getString("/Lotus/Language/Fish/FishSizeMediumAbbrev", lang)); - } else { - name = name - .split("|FISH_SIZE|") - .join(getString("/Lotus/Language/Fish/FishSizeSmallAbbrev", lang)); - } - } + const fishSizes = { + Large: "/Lotus/Language/Fish/FishSizeLargeAbbrev", + Medium: "/Lotus/Language/Fish/FishSizeMediumAbbrev", + Small: "/Lotus/Language/Fish/FishSizeSmallAbbrev", + }; + + if ("dissectionParts" in item) { + const fishDisplayName = getString("/Lotus/Language/Fish/FishDisplayName", lang); + let fishSizeKey = "Small"; // default + if (uniqueName.includes("Large")) fishSizeKey = "Large"; + else if (uniqueName.includes("Medium")) fishSizeKey = "Medium"; + + name = fishDisplayName + .replace("|FISH_NAME|", name) + .replace("|FISH_SIZE|", getString(fishSizes[fishSizeKey], lang)); + } ``` </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between e77f8b0e51f88d3c61feb3b8eefea449dbc8e3b3 and cb27da44772ca2b4a84925305892ea6d6e35b732. </details> <details> <summary>⛔ Files ignored due to path filters (1)</summary> * `package-lock.json` is excluded by `!**/package-lock.json` </details> <details> <summary>📒 Files selected for processing (2)</summary> * `package.json` (1 hunks) * `src/controllers/custom/getItemListsController.ts` (1 hunks) </details> <details> <summary>✅ Files skipped from review due to trivial changes (1)</summary> * package.json </details> <details> <summary>🔇 Additional comments (1)</summary><blockquote> <details> <summary>src/controllers/custom/getItemListsController.ts (1)</summary> `53-53`: **Properly uses the preprocessed `name`.** Switching from `getString(item.name, lang)` to the `name` variable ensures the fish-specific adjustments are retained. This is consistent with the new logic and looks good. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Sign in to join this conversation.
No description provided.