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: advance sort feature #106

Merged
merged 8 commits into from
Dec 2, 2024
Merged

Conversation

loxygenK
Copy link
Contributor

@loxygenK loxygenK commented Nov 30, 2024

つよいソートを実装しました。コンソールでは動いたのでたぶん動きます。MongoDB 上で loved_user_id がない古い名言データでも動くのを確認しています!

Added

  • --sort=<love|length|id> ... ソートをします。fav 数・名言の長さ・ID でソートできます。デフォルト値は id です。
  • --dir=<a|asc|d|desc> ... ソート順番を変更します。デフォルトの並び順はソート種類によって異なります。
  • --reversed (--rev, -R) … --dir=desc です。

Breaking change

ないです!最初はあったけど消えた

@loxygenK loxygenK requested a review from kawaemon November 30, 2024 18:58
@loxygenK loxygenK self-assigned this Nov 30, 2024
Comment on lines 119 to 123
ArgGroup::new("sort_conflict")
.args(&["sort"])
.requires("sort")
.conflicts_with("random")
))] // --sort and --random conflicts
Copy link
Member

Choose a reason for hiding this comment

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

--random --sort love の場合、ランダムにピックして、それらをいいね順にソートして表示 で成立する気がする

Copy link
Contributor Author

Choose a reason for hiding this comment

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

する やる(ジョイマン)

Comment on lines 131 to 134
ArgGroup::new("dir_group")
.args(&["dir"])
.requires_all(["sort", "dir"])
))] // --dir requires --sort
Copy link
Member

Choose a reason for hiding this comment

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

--sort id がデフォルト値でいいと思う。現在がそうなっているので

Copy link
Contributor Author

Choose a reason for hiding this comment

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

まかせろ

Comment on lines 169 to 172
/// 順番を入れ替えます。
#[clap(short, long, alias = "rev")]
#[clap(default_value_t = false)]
reverse: bool,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// 順番を入れ替えます
#[clap(short, long, alias = "rev")]
#[clap(default_value_t = false)]
reverse: bool,
/// 降順にします。--dir desc のエイリアスです
#[clap(short, long, alias = "rev")]
#[clap(default_value_t = false)]
reverse: bool,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

そうする

Comment on lines -219 to -220
res.sort_unstable_by_key(|x| x.id);

Copy link
Member

Choose a reason for hiding this comment

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

すまん

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#107 に免じてゆるされました

@kawaemon
Copy link
Member

kawaemon commented Dec 1, 2024

-r と -R 逆にすれば BC にならなくて良いのでは

@loxygenK
Copy link
Contributor Author

loxygenK commented Dec 2, 2024

ただしい そうする

@loxygenK
Copy link
Contributor Author

loxygenK commented Dec 2, 2024

((trait_ext 赦されたのか))

@loxygenK loxygenK force-pushed the feature/advanced-sort-feature branch from 68966ba to 0a192a8 Compare December 2, 2024 15:26
@loxygenK loxygenK requested a review from kawaemon December 2, 2024 15:41
@kawaemon kawaemon added this pull request to the merge queue Dec 2, 2024
Merged via the queue into master with commit 7258731 Dec 2, 2024
3 checks passed
@kawaemon kawaemon deleted the feature/advanced-sort-feature branch December 2, 2024 15:50
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