diff --git a/model/story/chapter.go b/model/story/chapter.go index c8c0876..6198d6d 100644 --- a/model/story/chapter.go +++ b/model/story/chapter.go @@ -41,7 +41,7 @@ func (chapter *Chapter) Edit(title, source *string, fictionalDate *time.Time) er changes["source"] = *source changed.Source = *source } - if fictionalDate != nil && *fictionalDate != chapter.FictionalDate { + if fictionalDate != nil && !fictionalDate.Equal(chapter.FictionalDate) { changes["fictionalDate"] = *fictionalDate changed.FictionalDate = *fictionalDate } diff --git a/model/story/story.go b/model/story/story.go index fb419f6..abb5fa3 100644 --- a/model/story/story.go +++ b/model/story/story.go @@ -84,23 +84,23 @@ func (story *Story) Edit(name, category *string, listed, open *bool, fictionalDa changes := bson.M{} changed := *story - if name != nil && *name == story.Name { + if name != nil && *name != story.Name { changes["name"] = *name changed.Name = *name } - if category != nil && *category == story.Category { + if category != nil && *category != story.Category { changes["category"] = *category changed.Name = *category } - if listed != nil && *listed == story.Listed { + if listed != nil && *listed != story.Listed { changes["listed"] = *listed changed.Listed = *listed } - if open != nil && *open == story.Open { + if open != nil && *open != story.Open { changes["open"] = *open changed.Open = *open } - if fictionalDate != nil && *fictionalDate == story.FictionalDate { + if fictionalDate != nil && !fictionalDate.Equal(story.FictionalDate) { changes["fictionalDate"] = *fictionalDate changed.FictionalDate = *fictionalDate }