Skip to content

Commit d5070a0

Browse files
committed
fix approvals counting
1 parent 7b00962 commit d5070a0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

models/org_team.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,11 +760,14 @@ func IsUserInTeams(userID int64, teamIDs []int64) (bool, error) {
760760
}
761761

762762
// UsersInTeamsCount counts the number of users which are in userIDs and teamIDs
763-
func UsersInTeamsCount(userIDs []int64, teamIDs []int64) (count int64, err error) {
764-
if count, err = x.In("uid", userIDs).In("team_id", teamIDs).Count(new(TeamUser)); err != nil {
763+
func UsersInTeamsCount(userIDs []int64, teamIDs []int64) (int64, error) {
764+
var ids []int64
765+
if err := x.In("uid", userIDs).In("team_id", teamIDs).
766+
Table("team_user").
767+
Cols("uid").GroupBy("uid").Find(&ids); err != nil {
765768
return 0, err
766769
}
767-
return
770+
return int64(len(ids)), nil
768771
}
769772

770773
// ___________ __________

0 commit comments

Comments
 (0)