Files
bamort/backend/bmrt/character/spell_utils.go
T
Bardioc26 042a1d4773 Learncost frontend (#42)
* introduced central package  registry by package init function
* dynamic registration of routes, model, migrations and initializers.
* setting a docker compose project name to prevent shutdown of other containers with the same (composer)name
* ai documentation
* app template
* Create tests for ALL API entpoints in ALL packages Based on current data. Ensure that all API endpoints used in frontend are tested. These tests are crucial for the next refactoring tasks.
* adopting agent instructions for a more consistent coding style
* added desired module layout and debugging information
* Fix All Failing tests All failing tests are fixed now that makes the refactoring more easy since all tests must pass
* restored routes for maintenance
* added common translations
* added new tests for API Endpoint
* Merge branch 'separate_business_logic'
* added lern and skill improvement cost editing
* Set Docker image tag when building to prevent rebuild when nothing has changed
* add and remove PP for Weaponskill fixed
* add and remove PP for same named skills fixed
* add new task
2026-05-01 18:15:31 +02:00

29 lines
909 B
Go

package character
import (
"bamort/database"
"bamort/bmrt/models"
)
// getSpellCategoryNewSystem ermittelt die Zaubergruppe für einen gegebenen Zaubernamen
// Wenn es sich um einen Zauber handelt, wird die Kategorie zurückgegeben
// Andernfalls wird der ursprüngliche Name zurückgegeben
func getSpellCategoryNewSystem(name string) string {
var spell models.Spell
if err := database.DB.Where("name = ?", name).First(&spell).Error; err != nil {
// Kein Zauber gefunden, ursprünglichen Namen verwenden
return name
}
// Zauber gefunden, Kategorie direkt zurückgeben
// Die Kategorien sind bereits die vollen Namen wie "Beherrschen", "Verändern", etc.
return spell.Category
}
// isSpellNewSystem prüft, ob der gegebene Name ein Zauber ist
func isSpellNewSystem(name string) bool {
var spell models.Spell
err := database.DB.Where("name = ?", name).First(&spell).Error
return err == nil
}