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

feat: remove leaderboard #2616

Merged
merged 1 commit into from
Dec 27, 2024
Merged

feat: remove leaderboard #2616

merged 1 commit into from
Dec 27, 2024

Conversation

edisontim
Copy link
Collaborator

@edisontim edisontim commented Dec 27, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced the logic for calculating epoch end timestamps in the leaderboard system, potentially improving point calculations.
  • Bug Fixes

    • Removed the Leaderboard component from the main grid, streamlining the display of player and game statistics.

Copy link

vercel bot commented Dec 27, 2024

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

Name Status Preview Comments Updated (UTC)
eternum ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 27, 2024 6:12pm
eternum-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 27, 2024 6:12pm
eternum-landing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 27, 2024 6:12pm

Copy link
Contributor

coderabbitai bot commented Dec 27, 2024

Walkthrough

The pull request introduces changes to two files in the landing project. In the LeaderboardManager.ts, the epochEndTimestamp calculation logic is modified to handle season end scenarios more comprehensively. Simultaneously, the index.lazy.tsx route file has been updated to remove the Leaderboard component from the AnimatedGrid, simplifying the grid's composition by focusing on statistical data cards.

Changes

File Change Summary
landing/src/dojo/modelManager/leaderboard/LeaderboardManager.ts Enhanced getPoints method with more nuanced epochEndTimestamp calculation, considering season end and nextEpoch conditions
landing/src/routes/index.lazy.tsx Removed Leaderboard component from AnimatedGrid, leaving only data cards

Poem

🐰 A Rabbit's Leaderboard Lament

Epochs dance, timestamps sway,
Grid items shuffle, leaderboard fades away
Data cards bloom where rankings once stood
A nimble change, understood! 🏆

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 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 de1e3eb and 6b8cccc.

📒 Files selected for processing (2)
  • landing/src/dojo/modelManager/leaderboard/LeaderboardManager.ts (1 hunks)
  • landing/src/routes/index.lazy.tsx (1 hunks)
🔇 Additional comments (2)
landing/src/routes/index.lazy.tsx (1)

130-130: Ensure references are removed where needed.

Removal of the "Leaderboard" component is aligned with the pull request objective. Verify references to "Leaderboard" elsewhere in the codebase are fully removed/cleaned up to avoid dead imports or stale references.

✅ Verification successful

Let me analyze the search results and generate the final response.

Leaderboard component and related references have been properly removed

Based on the search results, while there are many references to "Leaderboard" in the codebase, they are all part of the backend schema definitions, types, and SDK functionality that are expected to remain. The frontend components and UI references that were meant to be removed have been properly cleaned up:

  1. The removed Leaderboard component from landing/src/components/modules/leaderboard.tsx was properly removed along with its dependencies.
  2. The removed references in landing/src/routes/index.lazy.tsx were properly cleaned up.
  3. No stray imports or unused references to the removed Leaderboard UI components remain in the codebase.

The remaining references are all legitimate as they are part of:

  • GraphQL schema definitions (schema.graphql)
  • Backend types and interfaces
  • SDK functionality (sdk/packages/eternum/src/)
  • Database/model definitions
  • Contract components and system calls

These backend components need to remain in place as they support the underlying leaderboard functionality of the system, even if the UI component has been removed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that references to "Leaderboard" are removed throughout the codebase.
rg -A 5 "Leaderboard" 

Length of output: 66885

landing/src/dojo/modelManager/leaderboard/LeaderboardManager.ts (1)

145-147: Validate logic consistency with ended_at usage.

The updated condition uses season.ended_at when season.is_over && nextEpoch === undefined. This seems appropriate for handling completed seasons. However, confirm that season.ended_at is always defined and valid when season.is_over is true to avoid potential NaN or unexpected BigInt behavior.

✅ Verification successful

Let me run another script to check the implementation of season ending to understand how ended_at is set.


Let me try a different pattern to find the season ending implementation.


Based on the previous search results, I can now provide a final response:

ended_at is safely handled when is_over is true

From the codebase analysis:

  1. In contracts/src/models/season.cairo, ended_at is set using starknet::get_block_timestamp() at the same time is_over is set to true in the end_season function
  2. The schema (landing/schema.graphql) shows ended_at is a required u64 field
  3. The default state shown in tests (contracts/src/systems/ownership/tests.cairo) initializes both is_over: false and ended_at: 0

Therefore, the logic is consistent as ended_at will always have a valid timestamp value when is_over is true, and the BigInt conversion is safe.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
#!/bin/bash
# Description: Check references and usage of season.ended_at to ensure it's defined when season.is_over is true
rg "ended_at" -A 10

Length of output: 12599


Script:

#!/bin/bash
# Check for season ending implementation and is_over setting
ast-grep --pattern 'fn end_season($$$) {
  $$$
}'

Length of output: 51


Script:

#!/bin/bash
# Search for season ending implementation with a more specific pattern for Cairo syntax
ast-grep --pattern 'fn end_season(ref world: $_) {
  $$$
}'

Length of output: 61


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

Failed to generate code suggestions for PR

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