got categories from wrong source
This commit is contained in:
@@ -96,8 +96,12 @@ func TestGetMDSkillCategories(t *testing.T) {
|
||||
ski := models.Skill{}
|
||||
categories, err := ski.GetSkillCategories()
|
||||
assert.NoError(t, err)
|
||||
assert.LessOrEqual(t, 1, len(categories))
|
||||
assert.Equal(t, "Wissen", categories[0])
|
||||
assert.GreaterOrEqual(t, len(categories), 1, "Should have at least one skill category")
|
||||
// Check that categories come from learning_skill_categories table
|
||||
assert.Contains(t, categories, "Alltag", "Should contain 'Alltag' category")
|
||||
assert.Contains(t, categories, "Wissen", "Should contain 'Wissen' category")
|
||||
assert.Contains(t, categories, "Kampf", "Should contain 'Kampf' category")
|
||||
assert.Contains(t, categories, "Schilde und Parierwaffen", "Should contain 'Schilde und Parierwaffen' category")
|
||||
}
|
||||
|
||||
func TestGetMDSkills(t *testing.T) {
|
||||
|
||||
@@ -231,10 +231,9 @@ func (object *Skill) GetSkillCategories() ([]string, error) {
|
||||
var categories []string
|
||||
gameSystem := "midgard"
|
||||
|
||||
result := database.DB.Model(&Skill{}).
|
||||
Where("game_system = ? and category is not null", gameSystem).
|
||||
Distinct().
|
||||
Pluck("category", &categories)
|
||||
result := database.DB.Model(&SkillCategory{}).
|
||||
Where("game_system = ?", gameSystem).
|
||||
Pluck("name", &categories)
|
||||
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
@@ -376,10 +375,9 @@ func (object *Spell) GetSpellCategories() ([]string, error) {
|
||||
var categories []string
|
||||
gameSystem := "midgard"
|
||||
|
||||
result := database.DB.Model(&Spell{}).
|
||||
Where("game_system=? and category is not null", gameSystem).
|
||||
Distinct().
|
||||
Pluck("category", &categories)
|
||||
result := database.DB.Model(&SpellSchool{}).
|
||||
Where("game_system = ?", gameSystem).
|
||||
Pluck("name", &categories)
|
||||
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
|
||||
Reference in New Issue
Block a user