Skip to content

Commit

Permalink
Merge pull request #13 from AI-ASS/main
Browse files Browse the repository at this point in the history
fix the issue of model repetition
  • Loading branch information
Calcium-Ion authored Nov 23, 2023
2 parents 3808ae8 + 15d3e98 commit d4b3f87
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions model/ability.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ type Ability struct {
}

func GetGroupModels(group string) []string {
var abilities []Ability
//去重 enabled = true
DB.Where("`group` = ? and enabled = ?", group, true).Find(&abilities)
models := make([]string, 0, len(abilities))
for _, ability := range abilities {
models = append(models, ability.Model)
}
return models
var models []string
// Find distinct models
DB.Table("abilities").Where("`group` = ? and enabled = ?", group, true).Distinct("model").Pluck("model", &models)
return models
}

func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
Expand Down

0 comments on commit d4b3f87

Please sign in to comment.