Skip to content

Commit 1277084

Browse files
fix group team unit query
1 parent c32e157 commit 1277084

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

models/group/group_team.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type RepoGroupTeam struct {
2626

2727
func (g *RepoGroupTeam) LoadGroupUnits(ctx context.Context) error {
2828
var err error
29-
g.Units, err = GetUnitsByGroupID(ctx, g.GroupID)
29+
g.Units, err = GetUnitsByGroupID(ctx, g.GroupID, g.TeamID)
3030
return err
3131
}
3232

models/group/group_unit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ func (g *RepoGroupUnit) Unit() unit.Unit {
2424
return unit.Units[g.Type]
2525
}
2626

27-
func GetUnitsByGroupID(ctx context.Context, groupID int64) (units []*RepoGroupUnit, err error) {
28-
return units, db.GetEngine(ctx).Where("group_id = ?", groupID).Find(&units)
27+
func GetUnitsByGroupID(ctx context.Context, groupID, teamID int64) (units []*RepoGroupUnit, err error) {
28+
return units, db.GetEngine(ctx).Where("group_id = ?", groupID).And("team_id = ?", teamID).Find(&units)
2929
}
3030

3131
func GetGroupUnit(ctx context.Context, groupID, teamID int64, unitType unit.Type) (unit *RepoGroupUnit, err error) {

0 commit comments

Comments
 (0)