-
Notifications
You must be signed in to change notification settings - Fork 112
feat: add images to club players #114
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
base: main
Are you sure you want to change the base?
feat: add images to club players #114
Conversation
WalkthroughAdds optional Changes
Sequence DiagramsequenceDiagram
participant Client
participant Service as Player Service
participant XPath as XPath Utils
participant Response
Client->>Service: Request players
Service->>XPath: Query Clubs.Players.IMAGE
alt images found
XPath-->>Service: list of image URLs
else no images
XPath-->>Service: fallback list of None
end
Service->>Service: zip player fields with image values
Service-->>Response: players (each includes image field)
Response-->>Client: Return players
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/schemas/clubs/players.py(1 hunks)app/services/clubs/players.py(3 hunks)app/utils/xpath.py(1 hunks)tests/clubs/test_clubs_players.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/clubs/test_clubs_players.py (1)
tests/conftest.py (1)
len_greater_than_0(6-7)
app/services/clubs/players.py (2)
app/services/base.py (1)
get_list_by_xpath(132-150)app/utils/xpath.py (4)
Clubs(105-178)Clubs(197-199)Players(1-102)Players(148-178)
🔇 Additional comments (4)
app/utils/xpath.py (1)
156-156: LGTM! XPath selector is correct for lazy-loaded images.The XPath selector correctly targets the
data-srcattribute of img elements with the class 'bilderrahmen-fixed', which is the standard pattern for lazy-loaded images in the Transfermarkt DOM structure.app/schemas/clubs/players.py (1)
11-11: LGTM! Schema definition is correct.The optional image field is properly typed and positioned in the model.
tests/clubs/test_clubs_players.py (1)
39-39: LGTM! Test validation is correct.The test schema correctly validates that the image field can be either None or a non-empty string, which aligns with the Optional[str] schema definition.
app/services/clubs/players.py (1)
91-91: LGTM! Image field correctly integrated into player dictionaries.The image field is properly added to each player dictionary and correctly positioned in the zip function to align with other fields. Once the fallback value at line 59 is corrected, this implementation will be complete.
Also applies to: 105-109
Summary by CodeRabbit
New Features
Tests