bugfix preach related site

This commit is contained in:
Robert Janetzko 2022-05-06 13:18:43 +00:00
parent ce57fd472b
commit 1e8b4c9fcc
3 changed files with 10 additions and 11 deletions

View File

@ -511,7 +511,7 @@ func (obj Object) RelatedToMountain() string {
func (obj Object) Related(relation string, regex *regexp.Regexp, init string) string { func (obj Object) Related(relation string, regex *regexp.Regexp, init string) string {
var list []string var list []string
for n, f := range obj.Fields { for n, f := range obj.Fields {
if f.Type == "int" && !f.SameField(obj) && (relation == f.Related || regex.MatchString(n)) { if f.Type == "int" && !f.SameField(obj) && (relation == f.Related || (f.Related == "" && regex.MatchString(n))) {
if !f.Multiple { if !f.Multiple {
list = append(list, fmt.Sprintf("x.%s == id", f.Name)) list = append(list, fmt.Sprintf("x.%s == id", f.Name))
} else { } else {

View File

@ -9,7 +9,8 @@
"HistoricalEventMusicalFormCreated.FormId": "musicalForm", "HistoricalEventMusicalFormCreated.FormId": "musicalForm",
"HistoricalEventPoeticFormCreated.FormId": "poeticForm", "HistoricalEventPoeticFormCreated.FormId": "poeticForm",
"HistoricalEventHfReachSummit.MountainPeakId": "mountain", "HistoricalEventHfReachSummit.MountainPeakId": "mountain",
"HistoricalEventBuildingProfileAcquired.StructureId": "structure" "HistoricalEventBuildingProfileAcquired.StructureId": "structure",
"HistoricalEventHfPreach.SiteHfid": "site"
}, },
"AdditionalFields": { "AdditionalFields": {
"DfWorld": [ "DfWorld": [

View File

@ -11373,11 +11373,11 @@ func (s HistoricalEventHfPreachTopic) MarshalJSON() ([]byte, error) {
} }
type HistoricalEventHfPreach struct { type HistoricalEventHfPreach struct {
Entity1 int `json:"entity1" legend:"base" related:""` // entity_1 Entity1 int `json:"entity1" legend:"base" related:""` // entity_1
Entity2 int `json:"entity2" legend:"base" related:""` // entity_2 Entity2 int `json:"entity2" legend:"base" related:""` // entity_2
SiteHfid int `json:"siteHfid" legend:"base" related:""` // site_hfid SiteHfid int `json:"siteHfid" legend:"base" related:"site"` // site_hfid
SpeakerHfid int `json:"speakerHfid" legend:"base" related:""` // speaker_hfid SpeakerHfid int `json:"speakerHfid" legend:"base" related:""` // speaker_hfid
Topic HistoricalEventHfPreachTopic `json:"topic" legend:"base" related:""` // topic Topic HistoricalEventHfPreachTopic `json:"topic" legend:"base" related:""` // topic
} }
func NewHistoricalEventHfPreach() *HistoricalEventHfPreach { func NewHistoricalEventHfPreach() *HistoricalEventHfPreach {
@ -11392,11 +11392,9 @@ func (x *HistoricalEventHfPreach) Type() string { return "hf preach" }
func (x *HistoricalEventHfPreach) RelatedToEntity(id int) bool { func (x *HistoricalEventHfPreach) RelatedToEntity(id int) bool {
return x.Entity1 == id || x.Entity2 == id return x.Entity1 == id || x.Entity2 == id
} }
func (x *HistoricalEventHfPreach) RelatedToHf(id int) bool { func (x *HistoricalEventHfPreach) RelatedToHf(id int) bool { return x.SpeakerHfid == id }
return x.SiteHfid == id || x.SpeakerHfid == id
}
func (x *HistoricalEventHfPreach) RelatedToArtifact(id int) bool { return false } func (x *HistoricalEventHfPreach) RelatedToArtifact(id int) bool { return false }
func (x *HistoricalEventHfPreach) RelatedToSite(id int) bool { return false } func (x *HistoricalEventHfPreach) RelatedToSite(id int) bool { return x.SiteHfid == id }
func (x *HistoricalEventHfPreach) RelatedToStructure(siteId, id int) bool { return false } func (x *HistoricalEventHfPreach) RelatedToStructure(siteId, id int) bool { return false }
func (x *HistoricalEventHfPreach) RelatedToRegion(id int) bool { return false } func (x *HistoricalEventHfPreach) RelatedToRegion(id int) bool { return false }
func (x *HistoricalEventHfPreach) RelatedToWorldConstruction(id int) bool { return false } func (x *HistoricalEventHfPreach) RelatedToWorldConstruction(id int) bool { return false }