Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZO add advanced Set Filters #2654

Merged
merged 4 commits into from
Jan 31, 2025
Merged

ZO add advanced Set Filters #2654

merged 4 commits into from
Jan 31, 2025

Conversation

frzyc
Copy link
Owner

@frzyc frzyc commented Jan 30, 2025

Describe your changes

Adds a set filter:

  • Default: [] any (any set/rainbow)
  • User can quick select a set: [setKey] (disable rainbow, only builds with the set result)
  • User can select multiple sets [...setKey, ...] (disable rainbow, only builds with those sets result)

Add a new stage in solver. Builds that fail the set filters gets eliminated.
This should drastically increase build speed upon using the filter.

Issue or discord link

Testing/validation

Using the "quick UI" to select a set
image
Using the "Advanced UI" to select multiple sets
image

Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)

  • I have commented my code in hard-to understand areas.
  • I have made corresponding changes to README or wiki.
  • For front-end changes, I have updated the corresponding English translations.
  • I have run yarn run mini-ci locally to validate format and lint.
  • If I have added a new library or app, I have updated the deployment scripts to ignore changes as needed

@frzyc frzyc requested a review from nguyentvan7 January 30, 2025 07:32
Copy link
Contributor

coderabbitai bot commented Jan 30, 2025

Warning

Rate limit exceeded

@frzyc has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1a673dd and bff58e0.

📒 Files selected for processing (13)
  • libs/common/util/src/lib/object.ts (1 hunks)
  • libs/zzz/db/src/Database/DataManagers/CharacterDataManager.ts (6 hunks)
  • libs/zzz/page-optimize/src/BuildsDisplay.tsx (2 hunks)
  • libs/zzz/page-optimize/src/CharacterContext.ts (1 hunks)
  • libs/zzz/page-optimize/src/LevelFilter.tsx (1 hunks)
  • libs/zzz/page-optimize/src/Optimize.tsx (9 hunks)
  • libs/zzz/page-optimize/src/SetFilter.tsx (1 hunks)
  • libs/zzz/page-optimize/src/index.tsx (2 hunks)
  • libs/zzz/solver/src/calc.ts (2 hunks)
  • libs/zzz/solver/src/childWorker.ts (4 hunks)
  • libs/zzz/solver/src/common.ts (3 hunks)
  • libs/zzz/solver/src/parentWorker.ts (4 hunks)
  • libs/zzz/solver/src/solver.ts (4 hunks)

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

github-actions bot commented Jan 30, 2025

[zzz-frontend] [Thu Jan 30 07:35:32 UTC 2025] - Deployed 2a62ab4 to https://genshin-optimizer-prs.github.io/pr/2654/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Thu Jan 30 07:36:11 UTC 2025] - Deployed 2a62ab4 to https://genshin-optimizer-prs.github.io/pr/2654/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Thu Jan 30 07:37:34 UTC 2025] - Deployed 2a62ab4 to https://genshin-optimizer-prs.github.io/pr/2654/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Thu Jan 30 07:43:29 UTC 2025] - Deployed 47b0239 to https://genshin-optimizer-prs.github.io/pr/2654/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Thu Jan 30 07:43:39 UTC 2025] - Deployed 47b0239 to https://genshin-optimizer-prs.github.io/pr/2654/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Thu Jan 30 07:44:48 UTC 2025] - Deployed 47b0239 to https://genshin-optimizer-prs.github.io/pr/2654/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Thu Jan 30 07:53:53 UTC 2025] - Deployed 47b0239 to https://genshin-optimizer-prs.github.io/pr/2654/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Thu Jan 30 07:54:11 UTC 2025] - Deployed 47b0239 to https://genshin-optimizer-prs.github.io/pr/2654/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Thu Jan 30 07:55:34 UTC 2025] - Deployed 47b0239 to https://genshin-optimizer-prs.github.io/pr/2654/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Thu Jan 30 16:55:16 UTC 2025] - Deployed 3db7bdd to https://genshin-optimizer-prs.github.io/pr/2654/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Thu Jan 30 16:55:23 UTC 2025] - Deployed 3db7bdd to https://genshin-optimizer-prs.github.io/pr/2654/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Thu Jan 30 16:56:48 UTC 2025] - Deployed 3db7bdd to https://genshin-optimizer-prs.github.io/pr/2654/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Thu Jan 30 17:01:18 UTC 2025] - Deployed c9f6737 to https://genshin-optimizer-prs.github.io/pr/2654/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Thu Jan 30 17:01:53 UTC 2025] - Deployed c9f6737 to https://genshin-optimizer-prs.github.io/pr/2654/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Thu Jan 30 17:02:07 UTC 2025] - Deployed c9f6737 to https://genshin-optimizer-prs.github.io/pr/2654/frontend (Takes 3-5 minutes after this completes to be available)

[Fri Jan 31 00:12:11 UTC 2025] - Deleted deployment

@frzyc frzyc added the ZO Zenless Optimizer label Jan 30, 2025
} from '@mui/material'
import { useCharacterContext } from './CharacterContext'

export function SetFilter({ disabled = false }: { disabled?: boolean }) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very confusing with both force and set filter. should just remove the force option and have it be like GO (need to disable all 4p and 2p to 'force')

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its the same system, it allows people to "force" a single set without having to deal with the advanced config. I think quite a lot of the questions on GO was "how do you force a single set", now there is a shortcut without needing them to juggle a new concept

characterKey &&
database.chars.set(characterKey, {
setFilter4: setFilter4.length
? toggleInArr([...setFilter4], setKey)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is super unintuitive behavior. clicking should only toggle the specific set you clicked, not invert the whole selection

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases, when you are selecting sets, you only really need to select 2-3 of them, so this is similiar to the behaviour of our main stat filter, where first click selects just that 1, which ends up being overall less clicks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main stat filter on ZZZ works like how i describe (only toggles the specific stat you clicked)

this just goes back to the 3-state button again though so i wont rehash it

Copy link
Owner Author

@frzyc frzyc Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I will have to change the zenless one to be similiar to the 3 state button. I am kinda annoyed the amount of clicks needed to set main stats

libs/zzz/solver/src/calc.ts Outdated Show resolved Hide resolved

if (filter4.length) {
let has4 = false
for (const key in setCount) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do Object.entries(setCount).forEach(([key, count]) => {}) and it will have proper typings and no need for ! access

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but its less performant, since it creates a new array

for (const key in setCount) {
const k = key as DiscSetKey
if (setCount[k]! >= 4 && filter4.includes(k)) {
has4 = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we seem to do more of arr.every() or arr.any() checks rather than this for-break paradigm. not a big deal tho, just weird to read

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use more for loops in calc because they are more performant (how much so I can't attest), I much rather use array function otherwise for robustness

libs/zzz/solver/src/childWorker.ts Outdated Show resolved Hide resolved
@frzyc frzyc requested a review from nguyentvan7 January 30, 2025 16:56
@frzyc frzyc merged commit dd08f03 into master Jan 31, 2025
11 checks passed
@frzyc frzyc deleted the zo_setfilter branch January 31, 2025 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ZO Zenless Optimizer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ZO Advanced set filters
2 participants