results,err:=x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=?)",true)
results,err:=x.Query("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)
iferr!=nil{
iferr!=nil{
log.Error(4,"Select %s: %v",desc,err)
log.Error(4,"Select %s: %v",desc,err)
}else{
}else{
for_,result:=rangeresults{
for_,result:=rangeresults{
id:=com.StrTo(result["id"]).MustInt64()
id:=com.StrTo(result["id"]).MustInt64()
log.Trace("Updating %s: %d",desc,id)
log.Trace("Updating %s: %d",desc,id)
_,err=x.Exec("UPDATE `repository` SET num_closed_issues=(SELECT COUNT(*) FROM `issue` WHERE repo_id=? AND is_closed=?) WHERE id=?",id,true,id)
_,err=x.Exec("UPDATE `repository` SET num_closed_issues=(SELECT COUNT(*) FROM `issue` WHERE repo_id=? AND is_closed=? AND is_pull=?) WHERE id=?",id,true,false,id)