1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Fix approvals counting (#7757) (#7777)

* fix approvals counting

* fix tests

* fmt
This commit is contained in:
Lunny Xiao
2019-08-07 15:24:01 +08:00
committed by GitHub
parent aea49d0b92
commit 7b92f91e88
2 changed files with 9 additions and 6 deletions

View File

@@ -755,11 +755,14 @@ func IsUserInTeams(userID int64, teamIDs []int64) (bool, error) {
}
// UsersInTeamsCount counts the number of users which are in userIDs and teamIDs
func UsersInTeamsCount(userIDs []int64, teamIDs []int64) (count int64, err error) {
if count, err = x.In("uid", userIDs).In("team_id", teamIDs).Count(new(TeamUser)); err != nil {
func UsersInTeamsCount(userIDs []int64, teamIDs []int64) (int64, error) {
var ids []int64
if err := x.In("uid", userIDs).In("team_id", teamIDs).
Table("team_user").
Cols("uid").GroupBy("uid").Find(&ids); err != nil {
return 0, err
}
return
return int64(len(ids)), nil
}
// ___________ __________