Skip to content

Conversation

@SlayerOrnstein
Copy link
Member

@SlayerOrnstein SlayerOrnstein commented Mar 18, 2025

Warframe Drop Data Site Pull Request


What I did:
I used completion runs as stage text since profit taker has different rewards for first runs and subsequent runs


Why I did it:
The tables for profit taker have table headers for "First Completion" and "Second completion" so because these are headers they don't contain more then one element causing the parser to create this json structure

[
	{
        "id": "d30d044dd734153462ada8512ccf9cbb",
        "level": "Level 40 - 60 PROFIT-TAKER - PHASE 3",
        "rewards": {
            "a": [],
            "b": [],
            "c": []
        }
    },
    {
        "id": "e5460fddd3491fc6098d28b5b502418a",
        "level": "First Completion",
        "rewards": {
            "a": [],
            "b": [],
            "c": [... ]
        }
    },
    {
        "id": "370eee33ad52f69bcf9c47021dfeb548",
        "level": "Subsequent Completions",
        "rewards": {
            "a": [],
            "b": [],
            "c": [...]
		}
	}
]

Fixes issue (include link):
Describe the issue, if there was one


Mockups, screenshots, evidence:


Was this an issue fix or a suggestion fulfillment?

Summary by CodeRabbit

  • Bug Fixes
    • Improved bounty rewards display to ensure stage information is determined accurately. Now, when completion-related details are available, the displayed stage correctly reflects the reward’s progress, providing clearer and more consistent information.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2025

Walkthrough

The changes add a new variable completion within lib/bountyRewards.js to capture header text containing "Completion" during table processing. When such a header is encountered, the completion variable is assigned the header text. The logic for assigning the stage property in the bountyReward object is modified to use completion ?? stageText, meaning if completion has a value, it is prioritized; otherwise, stageText is used.

Changes

File Change Summary
lib/bountyRewards.js - Added variable completion to capture header text when it includes "Completion"
- Updated table header handling logic
- Modified bountyReward.stage assignment to use completion ?? stageText

Sequence Diagram(s)

sequenceDiagram
    participant P as Parser
    participant H as Header Checker
    participant B as BountyReward Object

    P->>H: Pass header text
    alt Header contains "Completion"
        H-->>P: Return text as completion value
    else Header does not contain "Completion"
        H-->>P: Ignore and use default stageText
    end
    P->>B: Assign stage = completion ?? stageText
Loading

Suggested reviewers

  • TobiTenno

Poem

I'm a rabbit, full of cheer,
Hopping through the code so clear.
"Completion" now finds its place,
In bounty rewards, setting the pace.
With every change, I smile with grace!
(_/)( •_•)( >🌟)

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

lib/bountyRewards.js

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-prettier".

(The package "eslint-plugin-prettier" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-prettier@latest --save-dev

The plugin "eslint-plugin-prettier" was referenced from the config file in ".eslintrc.json » @wfcd/eslint-config".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 456ae8f and 913872e.

📒 Files selected for processing (1)
  • lib/bountyRewards.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/bountyRewards.js

🪧 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.
  • @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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
lib/bountyRewards.js (1)

11-11: New variable addition without reset mechanism.

A new variable completion is introduced to track headers containing "Completion" text. However, unlike the rotation variable that gets reset when encountering new table headers (line 25), there's no mechanism to reset completion. This could lead to incorrect stage tagging if multiple reward sections are processed sequentially.

Consider adding a reset for the completion variable similar to how rotation is handled:

 if (elem.name === 'th') {
   const tmp = parseRotation(text);
   // Reset rotation when encountering a new table header.
   rotation = undefined;
+  // Reset completion when encountering a new table header.
+  completion = undefined;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55493b6 and 456ae8f.

📒 Files selected for processing (1)
  • lib/bountyRewards.js (3 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
lib/bountyRewards.js (12)
lib/blueprintLocations.js (1) (1)
  • text (12:12)
lib/dropByAvatar.js (1) (1)
  • text (13:13)
lib/enemyModTables.js (1) (1)
  • text (12:12)
lib/miscItems.js (1) (1)
  • text (14:14)
lib/keyRewards.js (1) (1)
  • text (15:15)
lib/enemyBlueprintTables.js (1) (1)
  • text (12:12)
lib/missionRewards.js (1) (1)
  • text (15:15)
lib/sortieRewards.js (1) (1)
  • text (12:12)
lib/modLocations.js (1) (1)
  • text (12:12)
lib/relics.js (1) (1)
  • text (12:12)
lib/transientRewards.js (1) (1)
  • text (13:13)
lib/syndicates.js (1) (1)
  • text (81:81)
🔇 Additional comments (3)
lib/bountyRewards.js (3)

29-31: Logical handling of "Completion" headers.

The added condition correctly identifies and stores header texts containing "Completion" (such as "First Completion" or "Subsequent Completions") in the completion variable. This effectively addresses the issue mentioned in the PR description where different rewards for first and subsequent completions needed to be properly categorized.


63-63: Improved stage assignment logic.

The use of the nullish coalescing operator (??) is a good choice here. It prioritizes using the completion text when available (for headers like "First Completion"), falling back to stageText otherwise. This change ensures the rewards are correctly categorized under the appropriate completion stages in the generated JSON structure.


1-73:

Details

❓ Verification inconclusive

Verify the fix with test data.

The changes look good for addressing the specific issue with Profit Taker rewards. To ensure the fix works correctly and doesn't affect other data, it would be beneficial to test it with both the Profit Taker data and other bounty tables.


🏁 Script executed:

#!/bin/bash
# Verify behavior with the Profit Taker data
# Look for the relevant JSON output to confirm proper structure

# Find files potentially importing bountyRewards.js
fd -t f -e js | xargs grep -l "bountyRewards" | grep -v "lib/bountyRewards.js"

# Check for any test files that might verify this functionality
fd -t f -e test.js -e spec.js

Length of output: 124


Profit Taker Rewards Fix – Verify with Broader Test Cases

The fix addresses the Profit Taker rewards issue as expected. The integration in files like generateData.js indicates that the changes are being used correctly. However, to ensure that other bounty table data isn’t inadvertently impacted, please run a full suite of tests (or add explicit test cases) covering both Profit Taker and non–Profit Taker data.

  • Confirm that the output in generateData.js (and any existing test files) reflects the correct structure for all bounty levels.
  • Consider augmenting the test suite to include varied bounty table scenarios for additional reassurance.

@SlayerOrnstein SlayerOrnstein enabled auto-merge (squash) March 18, 2025 19:40
@TobiTenno
Copy link
Member

what would that look like? could you drop in an example?

@SlayerOrnstein
Copy link
Member Author

what would that look like? could you drop in an example?

It's the same bounty as the one shown but with changes (some rewards were removed to shorten the example). The only difference is that stage will show whether it's First completion or Subsequent.

I believe that by "completion" DE means one full run, i.e. a new player running profit taker phase 3 for the first time will only get a Gravimag (most likely to introduce said new player to heavy guns)

{
        "id": "d30d044dd734153462ada8512ccf9cbb",
        "level": "Level 40 - 60 PROFIT-TAKER - PHASE 3",
        "rewards": {
            "a": [],
            "b": [],
            "c": [
                {
                    "id": "6a43383b6a6f13033b6a8ef6bb821d55",
                    "name": "Gravimag",
                    "rarity": "Common",
                    "chance": 100.0,
                    "stage": "First Completion"
                },
                {
                    "id": "1becbf9844d55739ab3861f4682352d7",
                    "name": "5X Gyromag Systems",
                    "rarity": "Uncommon",
                    "chance": 25.0,
                    "stage": "Subsequent Completions"
                },
             ...
            ]
        }
    }

@SlayerOrnstein SlayerOrnstein merged commit 3d7db30 into WFCD:main Mar 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants