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

[+] Allow disable music rank for own machine #110

Merged
merged 2 commits into from
Jan 18, 2025
Merged

Conversation

clansty
Copy link
Collaborator

@clansty clansty commented Jan 17, 2025

支持通过设置更改是否要给自己的机器显示推荐乐曲排行榜

因为我本地的数据貌似不够生成排行榜所以没有完全测试

Summary by Sourcery

允许禁用用户自己机器上的推荐音乐排名。

新功能:

  • 添加选项以禁用在用户机器上显示的推荐音乐排名。

测试:

  • 由于本地数据不足,仅进行部分测试。
Original summary in English

Summary by Sourcery

Allow disabling the recommended music rank for a user's own machine.

New Features:

  • Add an option to disable the recommended music rank displayed on a user's machine.

Tests:

  • Partially tested due to insufficient local data.

Copy link
Contributor

sourcery-ai bot commented Jan 17, 2025

Here's the translation of the review guide to Chinese:

审阅者指南 by Sourcery

此拉取请求引入了一个新功能,允许用户在自己的机器上禁用音乐排名显示。这是通过添加新的游戏选项并修改游戏排名处理程序以遵守此选项来实现的。

带有新禁用选项的音乐排名检索序列图

sequenceDiagram
    participant Game as Game Client
    participant Handler as GetGameRankingHandler
    participant Token as TokenChecker
    participant Options as GameOptions

    Game->>Handler: Request ranking (type=1)
    Handler->>Token: getCurrentSession()
    Token->>Options: Get user.gameOptions
    Options-->>Handler: Return enableMusicRank setting
    alt enableMusicRank is true
        Handler-->>Game: Return music ranking list
    else enableMusicRank is false
        Handler-->>Game: Return empty list
    end
Loading

数据库变更的实体关系图

erDiagram
    AQUA_GAME_OPTIONS {
        bit enable_music_rank
    }
    note for AQUA_GAME_OPTIONS "添加 enable_music_rank 列,默认值为 1"
Loading

显示更新的游戏选项结构的类图

classDiagram
    class AquaGameOptions {
        +String chusanMatchingReflector
        +Boolean enableMusicRank
    }
    class GetGameRankingHandler {
        -List musicRankingCache
        +handle(Map request): Map
    }
    note for AquaGameOptions "添加 enableMusicRank 字段"
    note for GetGameRankingHandler "修改为检查 enableMusicRank 设置"
Loading

文件级变更

变更 详情 文件
添加新的游戏选项以启用或禁用音乐排名显示。
  • AquaGameOptions 实体中添加 enableMusicRank 字段。
  • 添加新的数据库迁移,在 aqua_game_options 表中添加 enable_music_rank 列。
src/main/java/icu/samnyan/aqua/net/db/AquaGameOptions.kt
src/main/resources/db/V1000_35__maimai2_optional_music_rank.sql
修改游戏排名处理程序以遵守新的游戏选项。
  • 修改 GetGameRankingHandler,在返回音乐排名之前检查 enableMusicRank 选项。
src/main/java/icu/samnyan/aqua/sega/maimai2/handler/GetGameRankingHandler.kt
在前端添加新设置以控制新的游戏选项。
  • Mai2Settings.svelte 中添加新的 GameSettingFields 组件。
  • en_ref.tszh.ts 中为新设置添加新的 i18n 键。
AquaNet/src/components/settings/Mai2Settings.svelte
AquaNet/src/libs/i18n/en_ref.ts
AquaNet/src/libs/i18n/zh.ts

提示和命令

与 Sourcery 交互

  • 触发新的审阅: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub 问题: 通过回复审阅评论,要求 Sourcery 创建一个问题。
  • 生成拉取请求标题: 在拉取请求标题中的任何位置写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中的任何位置写 @sourcery-ai summary 以随时生成 PR 摘要。您还可以使用此命令指定摘要应插入的位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审阅功能,如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request introduces a new feature that allows users to disable the music rank display on their own machines. This is achieved by adding a new game option and modifying the game ranking handler to respect this option.

Sequence diagram for music ranking retrieval with new disable option

sequenceDiagram
    participant Game as Game Client
    participant Handler as GetGameRankingHandler
    participant Token as TokenChecker
    participant Options as GameOptions

    Game->>Handler: Request ranking (type=1)
    Handler->>Token: getCurrentSession()
    Token->>Options: Get user.gameOptions
    Options-->>Handler: Return enableMusicRank setting
    alt enableMusicRank is true
        Handler-->>Game: Return music ranking list
    else enableMusicRank is false
        Handler-->>Game: Return empty list
    end
Loading

Entity relationship diagram for database changes

erDiagram
    AQUA_GAME_OPTIONS {
        bit enable_music_rank
    }
    note for AQUA_GAME_OPTIONS "Added enable_music_rank column with default value 1"
Loading

Class diagram showing updated game options structure

classDiagram
    class AquaGameOptions {
        +String chusanMatchingReflector
        +Boolean enableMusicRank
    }
    class GetGameRankingHandler {
        -List musicRankingCache
        +handle(Map request): Map
    }
    note for AquaGameOptions "Added enableMusicRank field"
    note for GetGameRankingHandler "Modified to check enableMusicRank setting"
Loading

File-Level Changes

Change Details Files
Added a new game option to enable or disable music rank display.
  • Added enableMusicRank field to AquaGameOptions entity.
  • Added a new database migration to add the enable_music_rank column to the aqua_game_options table.
src/main/java/icu/samnyan/aqua/net/db/AquaGameOptions.kt
src/main/resources/db/V1000_35__maimai2_optional_music_rank.sql
Modified the game ranking handler to respect the new game option.
  • Modified GetGameRankingHandler to check the enableMusicRank option before returning the music ranking.
src/main/java/icu/samnyan/aqua/sega/maimai2/handler/GetGameRankingHandler.kt
Added a new setting to the frontend to control the new game option.
  • Added a new GameSettingFields component to Mai2Settings.svelte.
  • Added new i18n keys for the new setting in en_ref.ts and zh.ts.
AquaNet/src/components/settings/Mai2Settings.svelte
AquaNet/src/libs/i18n/en_ref.ts
AquaNet/src/libs/i18n/zh.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

@clansty - 我已经审查了你的更改,看起来非常棒!

以下是我在审查期间关注的内容
  • 🟢 一般性问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目是免费的 - 如果你喜欢我们的评论,请考虑分享 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用这些反馈来改进你的评论。
Original comment in English

Hey @clansty - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@clansty clansty merged commit 1515351 into v1-dev Jan 18, 2025
@clansty clansty deleted the feat/disable-music-rank branch January 18, 2025 17:44
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