-
Notifications
You must be signed in to change notification settings - Fork 50
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
ユーザ統計のバグ修正 #397
ユーザ統計のバグ修正 #397
Conversation
perl変更良さそうです! |
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.
for user in &users
のままでも問題は無いんですが、できればこうしたいのでこの変更も入れてほしいです。
diff --git a/webapp/rust/src/main.rs b/webapp/rust/src/main.rs
index 315621c..be6d75d 100644
--- a/webapp/rust/src/main.rs
+++ b/webapp/rust/src/main.rs
@@ -1766,8 +1766,8 @@ struct UserStatistics {
}
#[derive(Debug)]
-struct UserRankingEntry<'a> {
- username: &'a str,
+struct UserRankingEntry {
+ username: String,
score: i64,
}
@@ -1836,7 +1836,7 @@ async fn get_user_statistics_handler(
.await?;
let mut ranking = Vec::new();
- for user in &users {
+ for user in users {
let query = r#"
SELECT COUNT(*) FROM users u
INNER JOIN livestreams l ON l.user_id = u.id
@@ -1861,14 +1861,14 @@ async fn get_user_statistics_handler(
let score = reactions + tips;
ranking.push(UserRankingEntry {
- username: &user.name,
+ username: user.name,
score,
});
}
ranking.sort_by(|a, b| {
a.score
.cmp(&b.score)
- .then_with(|| a.username.cmp(b.username))
+ .then_with(|| a.username.cmp(&b.username))
});
let rpos = ranking
webapp/rust/src/main.rs
Outdated
.fetch_all(&mut *tx) | ||
.await?; | ||
|
||
for livestream in livestreams { |
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.
コンパイル通ってないのでここを参照にしてください
for livestream in livestreams { | |
for livestream in &livestreams { |
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.
ありがとうございます 🙇
こちらで対応しました dcd03e8
Perl、CIコケてますね。 |
https://github.com/isucon/isucon13/actions/runs/6978516358/job/18990868487#step:11:1 CIコケてるのは、変数名間違ってるのが原因みたいですね。 |
ありがとうございます 🙇 |
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.
Ruby、Rust は良さそうです。ランク算出で user
変数が被ってるのが気になるといえば気になりますが、まぁ Go 実装もそうなってるからな……
PHP みました問題ありません! |
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.
Perl気になるところ微調整をしました!大丈夫そうです!
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.
Node.js OK です!
ありがとうございます! |
#138