Fix places count while indexing
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
d72480200e
commit
aedc0279e3
3 changed files with 3 additions and 2 deletions
|
@ -75,6 +75,7 @@ func (m *Location) Find(api string) error {
|
|||
LocState: l.State(),
|
||||
LocCountry: l.CountryCode(),
|
||||
LocKeywords: l.KeywordString(),
|
||||
PhotoCount: 1,
|
||||
}
|
||||
|
||||
if err := place.Create(); err != nil {
|
||||
|
|
|
@ -19,7 +19,7 @@ type Place struct {
|
|||
LocKeywords string `gorm:"type:varchar(255);" json:"Keywords" yaml:"Keywords,omitempty"`
|
||||
LocNotes string `gorm:"type:text;" json:"Notes" yaml:"Notes,omitempty"`
|
||||
LocFavorite bool `json:"Favorite" yaml:"Favorite,omitempty"`
|
||||
PhotoCount int `json:"PhotoCount" yaml:"-"`
|
||||
PhotoCount int `gorm:"default:1" json:"PhotoCount" yaml:"-"`
|
||||
CreatedAt time.Time `json:"CreatedAt" yaml:"-"`
|
||||
UpdatedAt time.Time `json:"UpdatedAt" yaml:"-"`
|
||||
New bool `gorm:"-" json:"-" yaml:"-"`
|
||||
|
|
|
@ -186,7 +186,7 @@ func PhotoSearch(f form.PhotoSearch) (results PhotoResults, count int, err error
|
|||
}
|
||||
|
||||
if f.State != "" {
|
||||
s = s.Where("places.loc_state IN (?)", strings.Split(txt.Title(f.State), ","))
|
||||
s = s.Where("places.loc_state IN (?)", strings.Split(f.State, ","))
|
||||
}
|
||||
|
||||
if f.Category != "" {
|
||||
|
|
Loading…
Reference in a new issue