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
Fix issue comment number #30556
base: main
Are you sure you want to change the base?
Fix issue comment number #30556
Conversation
How much work would it be to add a migration that fixes the counts on existing issues? Would probably be a long-running migration on big instances, right? Also, not sure if such a migration would be backportable at all as it would likely skip migration numbers (a design flaw in the migration system). |
Yes, so I don't think the migration is necessary. The number will be corrected when next comment created/updated.
|
Yeah it's not really a requirement from me, more like a "nice to have" but likely too complicated with the migration backport to really be justified. |
Willing to approve this without migration once you fix the tests :) |
func CountCommentsBuilder(issueID int64) *builder.Builder { | ||
return builder.Select("count(*)").From("comment").Where(builder.Eq{ | ||
"issue_id": issueID, | ||
}.And(builder.Or( |
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.
Can this be converted into In
?
@@ -109,7 +109,7 @@ func userStatsCorrectNumRepos(ctx context.Context, id int64) error { | |||
} | |||
|
|||
func repoStatsCorrectIssueNumComments(ctx context.Context, id int64) error { | |||
return StatsCorrectSQL(ctx, "UPDATE `issue` SET num_comments=(SELECT COUNT(*) FROM `comment` WHERE issue_id=? AND type=0) WHERE id=?", id) | |||
return StatsCorrectSQL(ctx, "UPDATE `issue` SET num_comments=(SELECT COUNT(*) FROM `comment` WHERE issue_id=? AND (type=0 or type=22)) WHERE id=?", 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.
type=0 or type=22
use variable instead of number?
Fix #22419