Add Num{Issues,Pulls} stats checks (#21404)
- Currently `repository.Num{Issues,Pulls}` weren't checked and could become out-of-consistency. Adds these two checks to `CheckRepoStats`. - Fix incorrect SQL query for `repository.NumClosedPulls`, the check should be for `repo_num_pulls`. - Reference: https://codeberg.org/Codeberg/Community/issues/696
This commit is contained in:
parent
b59b0cad0a
commit
c540ee08d3
1 changed files with 13 additions and 1 deletions
|
@ -438,15 +438,27 @@ func CheckRepoStats(ctx context.Context) error {
|
||||||
repoStatsCorrectNumStars,
|
repoStatsCorrectNumStars,
|
||||||
"repository count 'num_stars'",
|
"repository count 'num_stars'",
|
||||||
},
|
},
|
||||||
|
// Repository.NumIssues
|
||||||
|
{
|
||||||
|
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", false, false),
|
||||||
|
repoStatsCorrectNumIssues,
|
||||||
|
"repository count 'num_issues'",
|
||||||
|
},
|
||||||
// Repository.NumClosedIssues
|
// Repository.NumClosedIssues
|
||||||
{
|
{
|
||||||
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, false),
|
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, false),
|
||||||
repoStatsCorrectNumClosedIssues,
|
repoStatsCorrectNumClosedIssues,
|
||||||
"repository count 'num_closed_issues'",
|
"repository count 'num_closed_issues'",
|
||||||
},
|
},
|
||||||
|
// Repository.NumPulls
|
||||||
|
{
|
||||||
|
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_pulls!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", false, true),
|
||||||
|
repoStatsCorrectNumPulls,
|
||||||
|
"repository count 'num_pulls'",
|
||||||
|
},
|
||||||
// Repository.NumClosedPulls
|
// Repository.NumClosedPulls
|
||||||
{
|
{
|
||||||
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, true),
|
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_pulls!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, true),
|
||||||
repoStatsCorrectNumClosedPulls,
|
repoStatsCorrectNumClosedPulls,
|
||||||
"repository count 'num_closed_pulls'",
|
"repository count 'num_closed_pulls'",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue