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

Parse player transfer history from Tfmkt endpoint #45

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

felipeall
Copy link
Owner

@felipeall felipeall commented Nov 9, 2023

Fix #44

Summary by CodeRabbit

  • New Features
    • Enhanced player transfer history with more detailed information.
  • Bug Fixes
    • Updated player transfer history parsing to ensure accurate data extraction.
  • Tests
    • Adjusted test cases to match the updated structure of player transfer data.

@felipeall felipeall linked an issue Nov 9, 2023 that may be closed by this pull request
Copy link

vercel bot commented Nov 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
transfermarkt-api ✅ Ready (Inspect) Visit Preview Nov 9, 2023 1:20am

Copy link

coderabbitai bot commented Nov 9, 2023

Walkthrough

The changes primarily focus on fixing the issue with player transfer data not displaying correctly. The code has been updated to fetch data from a new URL, and the parsing method has been modified to extract transfer details from the new data source. The structure of the "transfers" object has also been updated to reflect these changes.

Changes

File Change Summary
app/services/players/transfers.py Introduced a new URL for fetching player transfer data. Updated the parsing method to extract transfer details from the new data source. Modified the structure of the "transfers" object to reflect these changes.
app/utils/xpath.py Removed XPath expressions related to player transfer history and added an expression for youth clubs.
tests/players/test_players_transfers.py Updated the "transfers" object structure in the test function to match the changes in the main code. Added an "upcoming" boolean field to the "transfers" object.

Assessment against linked issues (Beta)

Objective Addressed Explanation
Identify the issue with the player transfer data not displaying correctly (#44)
Investigate why only youth clubs information is being shown (#44)
Determine if the problem is due to a bug in the code or a data source issue (#44)
Implement a fix to ensure that all player transfer data is displayed, not just youth clubs (#44) The new URL and updated parsing method should ensure that all player transfer data is displayed.
Test the solution to confirm that the player transfer data is now working as expected (#44) The test function has been updated to reflect the changes in the main code, which should confirm that the player transfer data is now working as expected.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b7cfc1c and 0043306.
Files selected for processing (3)
  • app/services/players/transfers.py (2 hunks)
  • app/utils/xpath.py (1 hunks)
  • tests/players/test_players_transfers.py (1 hunks)
Additional comments: 6
app/utils/xpath.py (1)
  • 57-58: The XPath expression for youth clubs has been added. Ensure that this XPath correctly fetches the required data from the webpage.
tests/players/test_players_transfers.py (1)
  • 23-39: The changes to the "transfers" object structure and the addition of the "upcoming" field are reflected correctly in the test. Ensure that the actual data returned by the get_player_transfers method matches this updated structure.
app/services/players/transfers.py (4)
  • 22-25: The new URL constant URL_TRANSFERS is introduced. Ensure that the URL is correct and the API endpoint is available.

  • 27-32: The __post_init__ method is updated to make a request to the new URL. Ensure that the request is successful and the response is as expected.

  • 34-64: The method __parse_player_transfers_history is renamed to __parse_player_transfer_history and its implementation is updated to parse transfer details from the new URL's response. Ensure that the parsing logic is correct and the output is as expected.

  • 72-78: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [66-78]

The get_player_transfers method is adjusted to use the updated parsing method. Ensure that the method returns the expected output.

@felipeall felipeall merged commit 7ba7bb0 into main Nov 9, 2023
3 checks passed
@felipeall felipeall deleted the fix/new-tfmkt-player-transfers-endpoint branch November 9, 2023 01:23
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.

Player Transfer Data not working
1 participant