-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
src/bot/meigen/mod.rs
Outdated
ArgGroup::new("sort_conflict") | ||
.args(&["sort"]) | ||
.requires("sort") | ||
.conflicts_with("random") | ||
))] // --sort and --random conflicts |
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.
--random --sort love
の場合、ランダムにピックして、それらをいいね順にソートして表示 で成立する気がする
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.
する やる(ジョイマン)
src/bot/meigen/mod.rs
Outdated
ArgGroup::new("dir_group") | ||
.args(&["dir"]) | ||
.requires_all(["sort", "dir"]) | ||
))] // --dir requires --sort |
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.
--sort id
がデフォルト値でいいと思う。現在がそうなっているので
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.
まかせろ
src/bot/meigen/mod.rs
Outdated
/// 順番を入れ替えます。 | ||
#[clap(short, long, alias = "rev")] | ||
#[clap(default_value_t = false)] | ||
reverse: bool, |
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.
/// 順番を入れ替えます。 | |
#[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, |
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.
そうする
res.sort_unstable_by_key(|x| x.id); | ||
|
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.
すまん
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.
#107 に免じてゆるされました
-r と -R 逆にすれば BC にならなくて良いのでは |
ただしい そうする |
((trait_ext 赦されたのか)) |
TakeAndApplyIf wasn't used after all, I'm sobbing so hard but nothing beats simplicity
68966ba
to
0a192a8
Compare
つよいソートを実装しました。コンソールでは動いたのでたぶん動きます。MongoDB 上で
loved_user_id
がない古い名言データでも動くのを確認しています!Added
--sort=<love|length|id>
... ソートをします。fav 数・名言の長さ・ID でソートできます。デフォルト値はid
です。--dir=<a|asc|d|desc>
... ソート順番を変更します。デフォルトの並び順はソート種類によって異なります。--reversed
(--rev
,-R
) …--dir=desc
です。Breaking change
ないです!最初はあったけど消えた