results,err=x.Query("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)
iferr!=nil{
log.Error("Select %s: %v",desc,err)
}else{
for_,result:=rangeresults{
id:=com.StrTo(result["id"]).MustInt64()
log.Trace("Updating %s: %d",desc,id)
_,err=x.Exec("UPDATE `repository` SET num_closed_pulls=(SELECT COUNT(*) FROM `issue` WHERE repo_id=? AND is_closed=? AND is_pull=?) WHERE id=?",id,true,true,id)
iferr!=nil{
log.Error("Update %s[%d]: %v",desc,id,err)
}
}
}
// ***** END: Repository.NumClosedPulls *****
// FIXME: use checker when stop supporting old fork repo format.
// FIXME: use checker when stop supporting old fork repo format.
// ***** START: Repository.NumForks *****
// ***** START: Repository.NumForks *****
results,err=x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_forks!=(SELECT COUNT(*) FROM `repository` WHERE fork_id=repo.id)")
results,err=x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_forks!=(SELECT COUNT(*) FROM `repository` WHERE fork_id=repo.id)")